@@ -1470,6 +1470,7 @@ def _complete_artifact_transformation(self, artifacts_data):
14701470 validator_jobs = []
14711471 with qdb .sql_connection .TRN :
14721472 cmd_id = self .command .id
1473+ parameters = self .parameters .values
14731474 for out_name , a_data in artifacts_data .items ():
14741475 # Correct the format of the filepaths parameter so we can
14751476 # create a validate job
@@ -1506,6 +1507,12 @@ def _complete_artifact_transformation(self, artifacts_data):
15061507 # belong to the same analysis, so we can just ask the
15071508 # first artifact for the analysis that it belongs to
15081509 analysis = self .input_artifacts [0 ].analysis .id
1510+ elif "analysis" in parameters :
1511+ # if we made it this far in the if/elif block it means that
1512+ # we are dealing with a job that was generated to link study/template
1513+ # artifacts and an analysis; thus, using the analysis parameter from
1514+ # the job itself
1515+ analysis = parameters ["analysis" ]
15091516
15101517 # Once the validate job completes, it needs to know if it has
15111518 # been generated from a command (and how) or if it has been
@@ -1521,11 +1528,10 @@ def _complete_artifact_transformation(self, artifacts_data):
15211528 cmd_out_id = qdb .sql_connection .TRN .execute_fetchlast ()
15221529 naming_params = self .command .naming_order
15231530 if naming_params :
1524- params = self .parameters .values
15251531 art_name = "%s %s" % (
15261532 out_name ,
15271533 " " .join (
1528- [str (params [p ]).split ("/" )[- 1 ] for p in naming_params ]
1534+ [str (parameters [p ]).split ("/" )[- 1 ] for p in naming_params ]
15291535 ),
15301536 )
15311537 else :
0 commit comments