Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
env.reset()
subprocess.call('sos remove -s', shell=True)
self.temp_files = []
def setUp(self):
env.reset()
subprocess.call('sos remove -s', shell=True)
self.temp_files = []
# bioinformatics can be running for long time...
# let me assume a longest running time of 1 month
walltime = sos_dict['_runtime']['walltime'] if 'walltime' in sos_dict['_runtime'] else 60*60*24*30
if isinstance(walltime, str):
if walltime.count(':') > 2:
raise ValueError('Incorrect format.')
try:
walltime = sum([int(val)*60**idx for idx, val in enumerate(walltime.split(':')[-1::-1])])
except Exception:
raise ValueError('Unacceptable walltime {} (can be "HH:MM:SS" or a number (seconds))'.format(walltime))
# tell subprocess where pysos.runtime is
self.proc_results.append(
self.celery_execute_task.apply_async(
(task, env.verbosity, env.sig_mode)
))
parser.error = lambda msg: env.logger.warning(msg)
return parser
def __exit__(self, *args):
self.end = time.time()
self.secs = self.end - self.start
self.msecs = self.secs * 1000 # millisecs
if self.verbose:
env.logger.info('Elapsed time ``%.03f`` seconds.' % self.secs)
def submit_task(self, task):
# if concurrent is set, create a pool object
from .celery import celery_execute_task
self.proc_results.append(
celery_execute_task.apply_async(
(task, env.verbosity, env.sig_mode)
))
def __init__(self, workflow, args=[], config_file=None, nested=False):
Base_Executor.__init__(self, workflow, args, config_file, nested=nested)
if hasattr(env, 'accessed_vars'):
delattr(env, 'accessed_vars')