Skip to content

Commit 7af3f73

Browse files
authored
supersede #3092 (#3093)
1 parent e9f6190 commit 7af3f73

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

qiita_db/software.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,14 @@ def create(cls, software, name, description, parameters, outputs=None,
425425
qdb.util.convert_to_id(at[0], 'artifact_type'),
426426
at[1]])
427427
else:
428-
sql_args.append(
429-
[pname, c_id,
430-
qdb.util.convert_to_id(at, 'artifact_type'),
431-
False])
428+
try:
429+
at_id = qdb.util.convert_to_id(at, 'artifact_type')
430+
except qdb.exceptions.QiitaDBLookupError:
431+
msg = (f'Error creating {software.name}, {name}, '
432+
f'{description} - Unknown artifact_type: '
433+
f'{at}')
434+
raise ValueError(msg)
435+
sql_args.append([pname, c_id, at_id, False])
432436

433437
sql = """INSERT INTO qiita.command_output
434438
(name, command_id, artifact_type_id,

qiita_db/test/test_software.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,16 @@ def test_create_error(self):
329329
"This is a command for testing", self.parameters,
330330
self.outputs)
331331

332+
# the output type doesn't exist
333+
with self.assertRaisesRegex(ValueError, "Error creating QIIME, Split "
334+
"libraries - wrong output, This is a "
335+
"command for testing - Unknown "
336+
"artifact_type: BLA!"):
337+
qdb.software.Command.create(
338+
self.software, "Split libraries - wrong output",
339+
"This is a command for testing", self.parameters,
340+
{'out': 'BLA!'})
341+
332342
def test_create(self):
333343
# let's deactivate all current plugins and commands; this is not
334344
# important to test the creation but it is important to test if a

scripts/qiita-recover-jobs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ def _retrieve_queue_jobs():
6565
return set(qiita_jids)
6666

6767

68-
def _count_jobs_in_arrays():
69-
# a direct way to calculate how many jobs are in the queue is to count
70-
# how many samples are in the preparation information file of the input
71-
# artifact
72-
jobs = [ProcessingJob(jid) for jid in _retrieve_queue_jobs()
73-
if ProcessingJob(jid).command.name in ARRAY_COMMANDS]
74-
return sum([len(job.input_artifacts[0].prep_templates[0]) for job in jobs])
68+
def _count_jobs_in_scheduler():
69+
# first let's count all regular jobs
70+
j1 = len(check_output(['qstat']).decode('ascii').split("\n"))
71+
# now, let's count the jobs in job arrays
72+
lines = check_output(['qstat', '-f']).decode('ascii').split("\n")
73+
j2 = sum([int(x.split(',')[-1].split('-')[-1])
74+
for x in lines if 'job_array_request' in x])
75+
return j1 + j2
7576

7677

7778
def _get_jids_to_recover(recover_type):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
classes = """
17-
Development Status :: 3 - Alpha
17+
Development Status :: 5 - Production/Stable
1818
License :: OSI Approved :: BSD License
1919
Topic :: Scientific/Engineering :: Bio-Informatics
2020
Topic :: Software Development :: Libraries :: Application Frameworks

0 commit comments

Comments
 (0)