diff --git a/QA/QA_Service/lib/qa_service.py b/QA/QA_Service/lib/qa_service.py index e8283195becfe50615448a3d5ed1d72f8716a2ad..c6aebbff522ec67e22d260245c7e660066023c0a 100644 --- a/QA/QA_Service/lib/qa_service.py +++ b/QA/QA_Service/lib/qa_service.py @@ -308,18 +308,26 @@ class QAService: hdf5_path = self.h5_lustre_filepath(obs_id) h5_dir_path, h5_filename = os.path.split(hdf5_path) - nr_of_timestamps = -1 - nr_of_subbands = -1 + logger.info('trying to convert MS uv dataset with otdb_id=%s subtask_id=%s if any', otdb_id, subtask_id) + cmd = ['ms2hdf5', '--cep4', '-p', '-22', '--output_dir', h5_dir_path, '--output_filename', h5_filename] if subtask_id: subtask = self.tmsssession.get_subtask(subtask_id=subtask_id) nr_of_timestamps = subtask['specifications_doc'].get('nr_of_timestamps', -1) nr_of_subbands = subtask['specifications_doc'].get('nr_of_subbands', -1) + cmd += ['-t', str(nr_of_timestamps), '-s', str(nr_of_subbands)] - logger.info('trying to convert MS uv dataset with otdb_id=%s subtask_id=%s if any', otdb_id, subtask_id) - cmd = ['ms2hdf5', '-o', str(obs_id), '--cep4', '-p', '-22', '-t', str(nr_of_timestamps), '-s', str(nr_of_subbands), ] - cmd += ['--output_dir', h5_dir_path] - cmd += ['--output_filename', h5_filename] + dataproducts = self.tmsssession.get_subtask_input_dataproducts(subtask_id=subtask_id) + + if not dataproducts: + raise ValueError("QA subtask %s has no input dataproducts" % subtask_id) + + directory = dataproducts[0]['directory'].replace('CEP4:', '').strip() + cmd += ['-m', directory] + elif otdb_id: + cmd += ['-o', str(obs_id)] + else: + raise ValueError("either otdb_id or subtask_id needs to be set") # wrap the command in a cep4 docker ssh call cmd = wrap_command_for_docker(cmd, 'adder', 'latest')