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
_______________________________________________
Fab-user mailing list
Fab-user@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to