def submit_job(seed): """Submit job to Stoomboot""" script = SCRIPT_TEMPLATE.format(seed=seed) name = 'spa_sim_{name}'.format(name=seed) qsub.submit_job(script, name, queue='long')
def test_submit_job(self, mock_delete, mock_check_output, mock_create, mock_which): mock_create.return_value = (sentinel.script_path, sentinel.script_name) mock_check_output.return_value = b'' qsub.submit_job(sentinel.script, sentinel.name, sentinel.queue, sentinel.extra) mock_create.assert_called_once_with(sentinel.script, sentinel.name) command = ('qsub -q {queue} -V -z -j oe -N {name} {extra} {script}' .format(queue=sentinel.queue, name=sentinel.script_name, script=sentinel.script_path, extra=sentinel.extra)) mock_check_output.assert_called_once_with(command, stderr=qsub.subprocess.STDOUT, shell=True) mock_delete.assert_called_once_with(sentinel.script_path)
def test_submit_job(self, mock_delete, mock_check_output, mock_create, mock_which): mock_create.return_value = (sentinel.script_path, sentinel.script_name) mock_check_output.return_value = b'' qsub.submit_job(sentinel.script, sentinel.name, sentinel.queue, sentinel.extra) mock_create.assert_called_once_with(sentinel.script, sentinel.name) command = ( 'qsub -q {queue} -V -z -j oe -N {name} {extra} {script}'.format( queue=sentinel.queue, name=sentinel.script_name, script=sentinel.script_path, extra=sentinel.extra)) mock_check_output.assert_called_once_with( command, stderr=qsub.subprocess.STDOUT, shell=True) mock_delete.assert_called_once_with(sentinel.script_path)
def perform_simulations(): for id in pbar(range(10)): script = SCRIPT.format(job_id=id) submit_job(script, 'spa_sim_%d' % id, 'long')
def perform_job(seeds, queue): script = SCRIPT.format(seeds=seeds) submit_job(script, seeds, queue)
import os from sapphire import CorsikaQuery, qsub OVERVIEW = '/data/hisparc/corsika/corsika_overview.h5' SCRIPT = """\ #!/usr/bin/env bash python /data/hisparc/adelaat/corsika_accuracy/simulation_station_time.py {seeds} """ if __name__ == "__main__": cq = CorsikaQuery(OVERVIEW) for e in [15, 15.5, 16, 16.5, 17]: sims = cq.simulations(zenith=0, energy=e, particle='proton') seeds_set = set(cq.seeds(sims)) print e for n in range(min(20, len(seeds_set), qsub.check_queue('generic'))): seeds = seeds_set.pop() if os.path.exists('%s.h5' % seeds): continue print seeds, qsub.submit_job(SCRIPT.format(seeds=seeds), 'cors_accu_%s' % seeds, 'generic') cq.finish()