Skip to content

Commit

Permalink
adding a couple of missing commands in ProcessingJob.shape
Browse files Browse the repository at this point in the history
  • Loading branch information
antgonza committed Jul 13, 2023
1 parent 36de016 commit 3ad01e8
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions qiita_db/processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,7 @@ def shape(self):
input_size = None

parameters = self.parameters.values
QUIDError = qdb.exceptions.QiitaDBUnknownIDError

if self.command.name == 'Validate':
# Validate only has two options to calculate it's size: template (a
Expand All @@ -1878,7 +1879,7 @@ def shape(self):
try:
PT = qdb.metadata_template.prep_template.PrepTemplate
prep_info = PT(parameters['template'])
except qdb.exceptions.QiitaDBUnknownIDError:
except QUIDError:
pass
else:
study_id = prep_info.study_id
Expand Down Expand Up @@ -1908,8 +1909,25 @@ def shape(self):
elif 'artifact' in parameters:
try:
artifact = qdb.artifact.Artifact(parameters['artifact'])
except qdb.exceptions.QiitaDBUnknownIDError:
except QUIDError:
pass
elif self.command.name == 'delete_sample_or_column':
v = self.parameters.values
try:
MT = qdb.metadata_template
if v['obj_class'] == 'SampleTemplate':
obj = MT.sample_template.SampleTemplate(v['obj_id'])
else:
obj = MT.prep_template.PrepTemplate(v['obj_id'])
except QUIDError:
pass
samples = len(obj)
elif self.command.name == 'Sequence Processing Pipeline':
body = self.parameters.values['sample_sheet']['body']
samples = body.count('\r')
stemp = body.count('\n')
if stemp > samples:
samples = stemp
elif self.input_artifacts:
artifact = self.input_artifacts[0]
if artifact.artifact_type == 'BIOM':
Expand All @@ -1933,7 +1951,7 @@ def shape(self):
if study_id is not None:
try:
st = qdb.study.Study(study_id).sample_template
except qdb.exceptions.QiitaDBUnknownIDError:
except QUIDError:
pass
else:
if prep_info is not None:
Expand Down

0 comments on commit 3ad01e8

Please sign in to comment.