/gridiot

a dumb script to distribute computing tasks via python, ssh

Primary LanguagePython

gridiot.py

Rev 6, nov 15, 2013

  • you will need automatic login via ssh-keys
  • on remote machines, your will need some RC file that sets your path for non-interactive shells
  • be careful with the clear_node_workdirs and pull_from_nodes functions!

##class Computing_Node()

  • fields
    • username
    • ip
    • port
    • workdir
    • freeslots -> number of cores to use
    • mode -> 'remote' or 'local'
    • returndir -> local dir that will be synced to after joblist is done

###__init__( username, ip, port, workdir, maxslots, mode, returndir)

###get_command( befehl )

###clear_workdir

  • remove the working directory on the remote machine

print_df(extracommand)

  • execute "df" on the remote machine
  • extracommand can be '' or for example " |grep sda" to pass to df

##class Job_Object()

__init__(self, befehl)

start( self, node)

def check( self):

##process_list(joblist,nodelist)

##push_to_nodes( nodelist, pushfilelist)

  • a list of files (or wildcards) in pushfilelist are transferred to the workdir on the remote machine / local dir

##pull_from_nodes(nodelist)

  • be careful with this!!! remote files will overwrite files that were pushed and that changed in the meantime!!!

##clear_node_workdirs(nodelist)

  • clear the workdirs on the nodes in nodelist

##print_df(nodelist):

  • exectute df on all nodes to get the free disk space

##addslash(directorystring)

  • will add a slash '/' to a string. Is used when building rsync commands to prevent file/directory hazzle