def __init__(self, target, args, n_nodes=config.DEFAULT_NODES, n_cores=config.DEFAULT_CORES, set_walltime=config.DEFAULT_WALLTIME, set_memory=config.DEFAULT_MEMORY, set_cpu=config.DEFAULT_CPU, wait_time=config.DEFAULT_WAIT_TIME, username=config.USERNAME, verbose=0): self.username = username self.ssh = ssh.SSH(self.username) self.qdel = qdel.QDel() self.target = target self.args = args self.temp_dir = 'temp_{}{}'.format( ''.join(str(time.time()).split('.')), random.randint(1000, 10000)) # FIX: Allocate resource functions self.n_nodes = n_nodes # Qsub script placeholder for number of cores self.n_cores = n_cores # Qsub script placeholder for the walltime allocated self.set_walltime = set_walltime self.allocate_walltime(self.set_walltime) # Qsub script placeholder for memory allocated self.set_memory = set_memory # Qsub script placeholder for cpu time allocated self.set_cpu = set_cpu self.wait_time = wait_time self.complete = False self.verbose = verbose self.job_id = None self.time_use = None self.user_quit = False self.max_time = None self.timer = False self.flags = '' self.update_qstat_on_comparison = True self.__type__ = "qsub"
def can_access_devcloud(self, key): """ Boolean function for searching for ssh key for devcloud Output: [True,False] """ ssh_interface = ssh.SSH(key) output = ssh_interface.send_command('cat /etc/machine-id')[0] return True if output == self.devcloud_id else False
def login(self, address): """Creates an SSH interface object with the address specified :param address: Address or name for ssh to :type address: str :returns: None :Example: >>> q = Qsub(job,arg) >>> q.login('192.168.1.42') """ if not isinstance(address, str): raise UserWarning("Invalid address arg type: {}".format( type(address).__name__)) self.ssh = ssh.SSH(address) self.username = address
def login(self, address): """Creates an SSH interface object with the address specified :param address: Address or name for ssh to :type address: str :returns: None :Example: >>> q = Qsub(job,arg) >>> q.login('192.168.1.42') .. note:: The default address is contained in clusterweb/pbs/username.txt and can be adjusted with `change_default_address` """ if not isinstance(address, str): raise UserWarning("Invalid address arg type: {}".format( type(address).__name__)) self.ssh_interface = ssh.SSH(address) self.username = address
def __init__(self): self.address = config.USERNAME self.ssh = ssh.SSH(self.address) self.qstat = qstat.Qstat()
def __init__(self, n_nodes=config.DEFAULT_NODES, n_cores=config.DEFAULT_CORES, set_walltime=config.DEFAULT_WALLTIME, set_memory=config.DEFAULT_MEMORY, set_cpu=config.DEFAULT_CPU, wait_time=config.DEFAULT_WAIT_TIME, verbose=0): """ A method's docstring with parameters and return value. Use all the cool Sphinx capabilities in this description, e.g. to give usage examples ... :Example: >>> another_class.foo('', AClass()) :param arg1: first argument :type arg1: string :param arg2: second argument :type arg2: :class:`module.AClass` :return: something :rtype: string :raises: TypeError """ """ Multi-job control of qsub submissions Multi-job Usage: >> with devcloud.Session() as sess: >> sess.load(job1) >> sess.load(job2) >> sess.load(job3) >> sess.run() >> [output1,output2,output3] = sess.output """ self.jobs = [] self.args = [] self.output = [] self.ssh = ssh.SSH(config.USERNAME) self.temp_dir = 'temp_{}{}'.format( ''.join(str(time.time()).split('.')), random.randint(10000, 100000)) # FIX: Allocate resource functions self.n_nodes = n_nodes # Qsub script placeholder for number of cores self.n_cores = n_cores # Qsub script placeholder for the walltime allocated self.set_walltime = set_walltime self.allocate_walltime(self.set_walltime) # Qsub script placeholder for memory allocated self.set_memory = set_memory # Qsub script placeholder for cpu time allocated self.set_cpu = set_cpu self.wait_time = wait_time self.all_complete = False self.verbose = verbose self.__type__ = "qsession"
def login(self, address): if not isinstance(address, str): raise UserWarning("Invalid address arg type: {}".format( type(address).__name__)) self.ssh_interface = ssh.SSH(address)
def __init__(self): self.ssh_interface = ssh.SSH(config.USERNAME)