Commit a767372a authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

update dispatch_obsgroup_detector: append task only if success

parent b18ad976
...@@ -345,6 +345,7 @@ class Dispatcher: ...@@ -345,6 +345,7 @@ class Dispatcher:
this_instrument = this_obsgroup_plan_basis["instrument"][0] this_instrument = this_obsgroup_plan_basis["instrument"][0]
effective_detector_names = csst[this_instrument].effective_detector_names effective_detector_names = csst[this_instrument].effective_detector_names
# loop over effective detectors
for this_effective_detector_name in effective_detector_names: for this_effective_detector_name in effective_detector_names:
this_task = dict( this_task = dict(
dataset=this_obsgroup_plan_basis["dataset"][0], dataset=this_obsgroup_plan_basis["dataset"][0],
...@@ -386,24 +387,25 @@ class Dispatcher: ...@@ -386,24 +387,25 @@ class Dispatcher:
# set n_file_expected and n_file_found # set n_file_expected and n_file_found
this_task["n_file_expected"] = n_file_expected this_task["n_file_expected"] = n_file_expected
this_task["n_file_found"] = n_file_found this_task["n_file_found"] = n_file_found
# append this task # append this task if this_success
task_list.append( if this_success:
dict( task_list.append(
task=this_task, dict(
success=this_success, task=this_task,
relevant_plan=this_obsgroup_plan_basis, success=this_success,
relevant_data=this_obsgroup_detector_found, relevant_plan=this_obsgroup_plan_basis,
n_relevant_plan=len(this_obsgroup_plan_basis), relevant_data=this_obsgroup_detector_found,
n_relevant_data=len(this_obsgroup_detector_found), n_relevant_plan=len(this_obsgroup_plan_basis),
relevant_data_id_list=( n_relevant_data=len(this_obsgroup_detector_found),
list(this_obsgroup_detector_found["_id"]) relevant_data_id_list=(
if n_file_found > 0 list(this_obsgroup_detector_found["_id"])
else [] if n_file_found > 0
), else []
n_file_expected=n_file_expected, ),
n_file_found=n_file_found, n_file_expected=n_file_expected,
n_file_found=n_file_found,
)
) )
)
return task_list return task_list
@staticmethod @staticmethod
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment