Skip to content

Commit

Permalink
supersede #3092 (#3093)
Browse files Browse the repository at this point in the history
  • Loading branch information
antgonza authored Apr 16, 2021
1 parent e9f6190 commit 7af3f73
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
12 changes: 8 additions & 4 deletions qiita_db/software.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,14 @@ def create(cls, software, name, description, parameters, outputs=None,
qdb.util.convert_to_id(at[0], 'artifact_type'),
at[1]])
else:
sql_args.append(
[pname, c_id,
qdb.util.convert_to_id(at, 'artifact_type'),
False])
try:
at_id = qdb.util.convert_to_id(at, 'artifact_type')
except qdb.exceptions.QiitaDBLookupError:
msg = (f'Error creating {software.name}, {name}, '
f'{description} - Unknown artifact_type: '
f'{at}')
raise ValueError(msg)
sql_args.append([pname, c_id, at_id, False])

sql = """INSERT INTO qiita.command_output
(name, command_id, artifact_type_id,
Expand Down
10 changes: 10 additions & 0 deletions qiita_db/test/test_software.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,16 @@ def test_create_error(self):
"This is a command for testing", self.parameters,
self.outputs)

# the output type doesn't exist
with self.assertRaisesRegex(ValueError, "Error creating QIIME, Split "
"libraries - wrong output, This is a "
"command for testing - Unknown "
"artifact_type: BLA!"):
qdb.software.Command.create(
self.software, "Split libraries - wrong output",
"This is a command for testing", self.parameters,
{'out': 'BLA!'})

def test_create(self):
# let's deactivate all current plugins and commands; this is not
# important to test the creation but it is important to test if a
Expand Down
15 changes: 8 additions & 7 deletions scripts/qiita-recover-jobs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ def _retrieve_queue_jobs():
return set(qiita_jids)


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


def _get_jids_to_recover(recover_type):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


classes = """
Development Status :: 3 - Alpha
Development Status :: 5 - Production/Stable
License :: OSI Approved :: BSD License
Topic :: Scientific/Engineering :: Bio-Informatics
Topic :: Software Development :: Libraries :: Application Frameworks
Expand Down

0 comments on commit 7af3f73

Please sign in to comment.