fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] using multiple command in same remote shell environment


From: VidJa Hunter
Subject: [Fab-user] using multiple command in same remote shell environment
Date: Fri, 28 Jun 2019 13:07:52 +0200

I'm new to fabric (v2.4) with Python 3.6.x

My target cluster uses 'module load' to load all kinds of software modules in a login shell. Goal is to fire off some long running(hours) commands

I'm currently using the following concept code to run multiple commands.
I'm wondering if this is the correct way of doing this or if I should use a different programming paradigm to run multiple successive commands
that rely on environment modifications by those commands on the remote server

def test_multiple_commands(c):
    command = []
    command.append('which python') # will return the base OS python v2.7
    command.append('pwd')
    command.append('cd ~/workspace') # should show my workspace
    command.append('module load biocluster_python/3.6.6') 
    command.append('which python') # will return the OS python v3.6.6 with lots of loaded python modules
    command.append('pwd')
    c.run(" && ".join(command))

if __name__=='__main__':
    c = Connection(BIOCLUSTER_LOGINNODE)
    test_multiple_commands(c)

Thanks in advance
Vid

reply via email to

[Prev in Thread] Current Thread [Next in Thread]