Skip to content

Commit

Permalink
small improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
antgonza committed Nov 14, 2023
1 parent ac62aba commit 3302b38
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
14 changes: 14 additions & 0 deletions qiita_db/processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,20 @@ def shape(self):

return samples, columns, input_size

@property
def complete_processing_job(self):
sql = """SELECT processing_job_id FROM qiita.software_command
JOIN qiita.processing_job USING (command_id)
WHERE name = 'complete_job' AND
command_parameters->>'job_id' = %s LIMIT 1"""
with qdb.sql_connection.TRN:
qdb.sql_connection.TRN.add(sql, [self.id])
result = qdb.sql_connection.TRN.execute_fetchflatten()

if result:
return ProcessingJob(result[0])
return None


class ProcessingWorkflow(qdb.base.QiitaObject):
"""Models a workflow defined by the user
Expand Down
1 change: 0 additions & 1 deletion qiita_db/test/test_processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ def test_complete_no_artifact_data(self):
job._set_status('running')
job.complete(True)
self.assertEqual(job.status, 'success')

job = qdb.processing_job.ProcessingJob.create(
qdb.user.User('[email protected]'),
qdb.software.Parameters.load(
Expand Down
9 changes: 7 additions & 2 deletions qiita_pet/handlers/api_proxy/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def _helper_process_params(params):
extra_atypes.append(atype[0])

eparams = []
extra_artifacts = defaultdict(list)
if artifact_id is not None:
artifact = Artifact(artifact_id)
analysis = artifact.analysis
Expand All @@ -117,11 +118,15 @@ def _helper_process_params(params):
del params[k]
eparams.append(_helper_process_params(params))

# removing this artifact from extra_artifacts
# removing this artifact from extra_atypes
if artifact.artifact_type in extra_atypes:
extra_atypes.remove(artifact.artifact_type)

extra_artifacts = defaultdict(list)
for aa in artifact.prep_templates[0].artifact.descendants.nodes():
atype = aa.artifact_type
if artifact_id != aa.id and atype in extra_atypes:
extra_artifacts[atype].append((aa.id, aa.name))

if analysis is not None:
analysis_artifacts = analysis.artifacts
for aa in analysis_artifacts:
Expand Down

0 comments on commit 3302b38

Please sign in to comment.