Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions qiita_pet/handlers/api_proxy/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def artifact_summary_get_request(user_id, artifact_id):
summary = artifact.html_summary_fp
job_info = None
errored_jobs = []
processing_jobs = [
[j.id, j.command.name, j.status, j.step] for j in artifact.jobs()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work? The braces are off.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean that the braces are off? It's a list comprehension generating a list of 4 elements, but filtering for those jobs that are part of an artifact transformation software. See this line for an example of the data generated here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks.

if j.command.software.type == "artifact transformation"]
# Check if the HTML summary exists
if summary:
with open(summary[1]) as f:
Expand Down Expand Up @@ -118,6 +121,7 @@ def artifact_summary_get_request(user_id, artifact_id):
'summary': summary,
'job': job_info,
'errored_jobs': errored_jobs,
'processing_jobs': processing_jobs,
'visibility': visibility,
'buttons': ' '.join(buttons)}

Expand Down
16 changes: 15 additions & 1 deletion qiita_pet/handlers/api_proxy/tests/test_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,23 @@ def tearDown(self):
def test_artifact_summary_get_request(self):
# Artifact w/o summary
obs = artifact_summary_get_request('test@foo.bar', 1)
exp_p_jobs = [
['6d368e16-2242-4cf8-87b4-a5dc40bb890b', 'Split libraries FASTQ',
'success', None],
['4c7115e8-4c8e-424c-bf25-96c292ca1931', 'Split libraries FASTQ',
'success', None],
['063e553b-327c-4818-ab4a-adfe58e49860', 'Split libraries FASTQ',
'queued', None],
['bcc7ebcd-39c1-43e4-af2d-822e3589f14d', 'Split libraries',
'running', 'demultiplexing'],
['b72369f9-a886-4193-8d3d-f7b504168e75', 'Split libraries FASTQ',
'success', None]]
exp = {'status': 'success',
'message': '',
'name': 'Raw data 1',
'summary': None,
'job': None,
'processing_jobs': exp_p_jobs,
'errored_jobs': [],
'visibility': 'private',
'buttons': '<button onclick="set_artifact_visibility'
Expand All @@ -160,6 +172,7 @@ def test_artifact_summary_get_request(self):
'name': 'Raw data 1',
'summary': None,
'job': [job.id, 'queued', None],
'processing_jobs': exp_p_jobs,
'errored_jobs': [],
'visibility': 'private',
'buttons': '<button onclick="set_artifact_visibility'
Expand All @@ -168,7 +181,7 @@ def test_artifact_summary_get_request(self):
'set_artifact_visibility(\'sandbox\', 1)" '
'class="btn btn-primary btn-sm">Revert to '
'sandbox</button>'}
self.assertEqual(obs, exp)
self.assertItemsEqual(obs, exp)

# Artifact with summary
fd, fp = mkstemp(suffix=".html")
Expand All @@ -184,6 +197,7 @@ def test_artifact_summary_get_request(self):
'name': 'Raw data 1',
'summary': '<b>HTML TEST - not important</b>\n',
'job': None,
'processing_jobs': exp_p_jobs,
'errored_jobs': [],
'visibility': 'private',
'buttons': '<button onclick="set_artifact_visibility'
Expand Down
16 changes: 15 additions & 1 deletion qiita_pet/templates/study_ajax/artifact_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<div class='col-md-12'>
<h4>
<i>Summary: {{name}} (ID: {{artifact_id}})</i>
<a class="btn btn-default glyphicon glyphicon-play" style="word-spacing: -10px;" onclick="populate_main_div('/study/process/', {artifact_id: {{artifact_id}} });"> Process</a>
<a class="btn btn-default btn-sm" onclick="populate_main_div('/study/process/', {artifact_id: {{artifact_id}} });"><span class="glyphicon glyphicon-play"></span> Process</a>
</h4>
</div>
</div>
Expand All @@ -59,6 +59,20 @@ <h4>
Visibility: {{visibility}} {% raw buttons %}
</div>
</div>
<div class='row'>
<div class='col-md-12'>
{% if processing_jobs %}
<b>Jobs using this set of files:</b></br>
{% end %}
{% for j_id, c_name, j_status, s_step in processing_jobs %}
Job <b>{{j_id}}</b> ({{c_name}}). Status: <i>{{j_status}}</i>.
{% if s_step %}
Step: <i>{{s_step}}</i>
{% end %}
</br>
{% end %}
</div>
</div>
<div class='row'>
<div class='col-md-12' id='artifact-summary-content'>
{% if summary is not None %}
Expand Down