Skip to content

Commit a57ef23

Browse files
committed
addressing all comments
1 parent 958fcbe commit a57ef23

File tree

11 files changed

+161
-79
lines changed

11 files changed

+161
-79
lines changed

qiita_db/test/test_user.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,26 @@ def test_user_artifacts(self):
450450
qdb.artifact.Artifact(7)]}
451451
self.assertEqual(obs, exp)
452452

453-
def test_jobs(self):
453+
def test_jobs_all(self):
454454
PJ = qdb.processing_job.ProcessingJob
455+
ignore_status = []
455456
# generates expected jobs
456-
jobs = qdb.user.User('shared@foo.bar').jobs()
457+
jobs = qdb.user.User('shared@foo.bar').jobs(ignore_status)
457458
self.assertEqual(jobs, [
458459
PJ('d19f76ee-274e-4c1b-b3a2-a12d73507c55'),
459460
PJ('b72369f9-a886-4193-8d3d-f7b504168e75')])
460461

462+
# no jobs
463+
self.assertEqual(qdb.user.User('admin@foo.bar').jobs(
464+
ignore_status), [])
465+
466+
def test_jobs_defaults(self):
467+
PJ = qdb.processing_job.ProcessingJob
468+
# generates expected jobs
469+
jobs = qdb.user.User('shared@foo.bar').jobs()
470+
self.assertEqual(jobs, [
471+
PJ('d19f76ee-274e-4c1b-b3a2-a12d73507c55')])
472+
461473
# no jobs
462474
self.assertEqual(qdb.user.User('admin@foo.bar').jobs(), [])
463475

qiita_db/user.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,23 +661,43 @@ def delete_messages(self, messages):
661661
qdb.sql_connection.TRN.add(sql)
662662
qdb.sql_connection.TRN.execute()
663663

664-
def jobs(self):
664+
def jobs(self, ignore_status=['success']):
665665
"""Return jobs created by the user
666666
667667
Parameters
668668
----------
669+
ignore_status, list of str
670+
don't retieve jobs that have one of these status
669671
670672
Returns
671673
-------
672674
list of ProcessingJob
673675
674676
"""
675677
with qdb.sql_connection.TRN:
676-
sql_info = [self._id]
677678
sql = """SELECT processing_job_id
678679
FROM qiita.processing_job
680+
LEFT JOIN qiita.processing_job_status
681+
USING (processing_job_status_id)
679682
WHERE email = %s
680-
ORDER BY heartbeat DESC"""
683+
"""
684+
685+
if ignore_status:
686+
sql_info = [self._id, tuple(ignore_status)]
687+
sql += " AND processing_job_status NOT IN %s"
688+
else:
689+
sql_info = [self._id]
690+
691+
sql += """
692+
ORDER BY CASE processing_job_status
693+
WHEN 'in_construction' THEN 1
694+
WHEN 'running' THEN 2
695+
WHEN 'queued' THEN 3
696+
WHEN 'waiting' THEN 4
697+
WHEN 'error' THEN 5
698+
WHEN 'success' THEN 6
699+
END, heartbeat DESC"""
700+
681701
qdb.sql_connection.TRN.add(sql, sql_info)
682702
return [qdb.processing_job.ProcessingJob(p[0])
683703
for p in qdb.sql_connection.TRN.execute_fetchindex()]

qiita_pet/handlers/api_proxy/tests/test_user.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,8 @@ def test_user_jobs_get_req(self):
4646
'threads': 1,
4747
'sortmerna_coverage': 0.97},
4848
'name': 'Pick closed-reference OTUs',
49-
'processing_job_workflow_id': ''},
50-
{'id': 'b72369f9-a886-4193-8d3d-f7b504168e75',
51-
'status': 'success',
52-
'heartbeat': '2015-11-22 21:15:00',
53-
'params': {
54-
'max_barcode_errors': 1.5,
55-
'sequence_max_n': 0,
56-
'max_bad_run_length': 3,
57-
'phred_offset': u'auto',
58-
'rev_comp': False,
59-
'phred_quality_threshold': 3,
60-
'input_data': 1,
61-
'rev_comp_barcode': False,
62-
'rev_comp_mapping_barcodes': True,
63-
'min_per_read_length_fraction': 0.75,
64-
'barcode_type': u'golay_12'},
65-
'name': 'Split libraries FASTQ',
66-
'processing_job_workflow_id': 1}]}
49+
'step': 'generating demux file',
50+
'processing_job_workflow_id': ''}]}
6751
self.assertEqual(obs, exp)
6852

6953

qiita_pet/handlers/api_proxy/user.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
@execute_as_transaction
14-
def user_jobs_get_req(user, limit=10):
14+
def user_jobs_get_req(user, limit=30):
1515
"""Gets the json of jobs
1616
1717
Parameters
@@ -42,6 +42,7 @@ def user_jobs_get_req(user, limit=10):
4242
'params': j.parameters.values,
4343
'status': j.status,
4444
'heartbeat': hb,
45+
'step': j.step,
4546
'processing_job_workflow_id': wid})
4647

4748
return {'status': 'success',

qiita_pet/static/css/style.css

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
1-
div.qiita-main {
1+
#qiita-main {
22
position: relative;
33
height: 100%;
44
width: 100%;
55
}
6-
76
#qiita-processing {
87
position: absolute;
98
height: 100%;
109
width: 0%;
1110
right: 0;
1211
top: 0;
1312
}
14-
1513
#template-content{
1614
padding: 10px;
1715
height: 100%;
1816
width: 100%;
1917
}
2018

19+
td.more-info-processing-jobs{
20+
cursor: pointer;
21+
background: url('../img//details_open.png') no-repeat center center;
22+
}
23+
tr.shown td.more-info-processing-jobs {
24+
background: url('../img//details_close.png') no-repeat center center;
25+
}
26+
2127
/* table in the study description that holds the investigation type elements */
2228
.investigation-type-table td {
2329
padding-top: 6px;
841 Bytes
Loading

qiita_pet/static/img/details_open.png

881 Bytes
Loading

qiita_pet/static/js/qiita.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,46 @@ function bootstrapAlert(message, severity, timeout){
2929
alertDiv.append('<p style="text-align:center">Need help? Send us an <a href="mailto:qiita.help@gmail.com">email</a>.</p>');
3030
}
3131

32-
$('body').prepend(alertDiv);
32+
$('#qiita-main').prepend(alertDiv);
3333

3434
if(timeout > 0) {
3535
window.setTimeout(function() { $('#alert-message').alert('close'); }, timeout);
3636
}
3737
}
3838

39+
function format_extra_info_processing_jobs ( data ) {
40+
// `data` is the original data object for the row
41+
// 0: blank +/- button
42+
// 1: heartbeat
43+
// 2: name
44+
// 3: status
45+
// 4: step
46+
// 5: id
47+
// 6: params
48+
// 7: processing_job_workflow_id
49+
50+
let row = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">'+
51+
'<tr>'+
52+
'<td><b>ID:</b></td>'+
53+
'<td>'+ data[5] +'</td>'+
54+
'</tr>'+
55+
'<tr>'+
56+
'<td colspan="2"><h5>Parameters:</h5>'+ data[6] +'</td>'+
57+
'</tr>';
58+
if (data[7] !== '') {
59+
row += '<tr>'+
60+
'<td colspan="2">'+
61+
'<button class="btn btn-danger btn-sm" onclick="remove_job(\''+ data[5] + "', '" + data[7] +'\');">'+
62+
'<span class="glyphicon glyphicon-trash"></span></button>'+
63+
'</td>'
64+
'</tr>';
65+
}
66+
row += '</table>';
67+
68+
return row
69+
}
70+
71+
3972
function show_hide(div) {
4073
$('#' + div).toggle();
4174
}
@@ -60,6 +93,8 @@ function delete_analysis(aname, analysis_id) {
6093

6194
function show_hide_process_list() {
6295
if ($("#qiita-main").width() == $("#qiita-main").parent().width()) {
96+
// let's update the job list
97+
processing_jobs_vue.update_processing_job_data();
6398
$("#qiita-main").width("76%");
6499
$("#user-studies-table").width("76%");
65100
$("#studies-table").width("76%");

qiita_pet/templates/list_studies.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
<link rel="stylesheet" href="{% raw qiita_config.portal_dir %}/static/vendor/css/select2.min.css" type="text/css">
66

77
<style>
8-
#alert-message {
9-
position: fixed;
10-
top: 50px;
11-
left: 40px;
12-
z-index:100;
13-
}
148
td.details-control {
159
cursor: pointer;
1610
}

qiita_pet/templates/portals_edit.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@
1010
.portal-select {
1111
width: 15em;
1212
}
13-
#alert-message {
14-
position: fixed;
15-
top: 55px;
16-
left:30%;
17-
z-index:100;
18-
white-space: nowrap;
19-
}
2013
</style>
2114
<script type="text/javascript">
2215
function check_submit(action) {

0 commit comments

Comments
 (0)