Skip to content
Snippets Groups Projects
Commit 31ece273 authored by Soichiro Morisaki's avatar Soichiro Morisaki
Browse files

gwcelery/tasks/inference.py: fix a bug in uploading bilby samples

parent 1ac1d73b
No related branches found
No related tags found
1 merge request!906gwcelery/tasks/inference.py: fix a bug in uploading bilby samples
......@@ -584,9 +584,9 @@ def dag_finished(rundir, preferred_event_id, superevent_id, pe_pipeline):
resultdir = os.path.join(rundir, 'result')
sampledir = os.path.join(rundir, 'final_result')
sample_filename = 'Bilby.posterior_samples.hdf5'
input_sample, = glob.glob(os.path.join(sampledir, '*result.hdf5'))
subprocess.run(
['bilby_pipe_to_ligo_skymap_samples',
os.path.join(sampledir, '*result.hdf5'),
['bilby_pipe_to_ligo_skymap_samples', input_sample,
'--out', os.path.join(sampledir, sample_filename)])
uploads = [
(sampledir, sample_filename,
......
......@@ -355,7 +355,6 @@ def test_dag_finished(monkeypatch, tmp_path, pipeline):
_upload_url)
monkeypatch.setattr('gwcelery.tasks.gracedb.create_label.run',
create_label)
monkeypatch.setattr('subprocess.run', Mock())
if pipeline in ['lalinference', 'bilby']:
if pipeline == 'lalinference':
......@@ -368,6 +367,10 @@ def test_dag_finished(monkeypatch, tmp_path, pipeline):
os.path.join(pe_results_path, 'extrinsic.png'),
os.path.join(pe_results_path, 'sourceFrame.png')]
else:
input_sample = os.path.join(sampledir, "test_result.hdf5")
with open(input_sample, 'wb') as f:
f.write(b'result')
monkeypatch.setattr('subprocess.run', Mock())
paths = [os.path.join(sampledir, 'Bilby.posterior_samples.hdf5'),
os.path.join(resultdir, 'bilby_extrinsic_corner.png'),
os.path.join(resultdir, 'bilby_intrinsic_corner.png')]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment