def bsub_orthology_query(cache_key, cache_file, query_kws, job_name): lsf_options = ['-o', '/dev/null', '-N', # '-q', 'short', # short is a big queue but often busy '-q', 'cbi_12h', # cbi_12h has few nodes but is rarely busy '-W', '2:0', '-J', job_name] filename = filemsg.dump({'cache_key': cache_key, 'cache_file': cache_file, 'query_kws': query_kws}) cmd = cliutil.args(__file__) + ['orthquery', '--params', filename] return lsf.bsub(cmd, lsf_options)
def _bsub_task(ns, task, lsfopts, devnull=True): ''' Submit a task to lsf ''' filename = filemsg.dump([ns, task]) cmd = cliutil.args(__file__) + ['run_task', filename] devnull_option = ['-o', '/dev/null'] if devnull else [] jobname_option = ['-J', _lsf_job_name(ns, task.name)] lsfopts = devnull_option + list(lsfopts) + jobname_option return lsf.bsub(cmd, lsfopts)
def test_msg(): msg = ([1, 2], {'hi': 'bye'}) # serialize msg to a file filename = filemsg.dump(msg) print filename # Confirm that the file was written assert os.path.exists(filename) # read msg and delete file out = filemsg.load(filename) # Test that the unserialized values equal the serialized ones. assert msg == out # Confirm that the file was deleted assert not os.path.exists(filename)