From 3782c12ade07f4170036c0c9bda974eaee17ecf5 Mon Sep 17 00:00:00 2001 From: zech Date: Thu, 15 Aug 2013 14:03:57 -0600 Subject: [PATCH] fixed #13; commbined load_study.psp and check_job_status.psp --- www/check_job_status.psp | 36 +++++++++++++++++++++++++++++++++++- www/js/jobs.js | 34 +--------------------------------- www/load_study.psp | 38 -------------------------------------- www/select_study_task.psp | 19 ++----------------- 4 files changed, 38 insertions(+), 89 deletions(-) mode change 100644 => 100755 www/js/jobs.js delete mode 100644 www/load_study.psp diff --git a/www/check_job_status.psp b/www/check_job_status.psp index 807cc11b..8ad80734 100644 --- a/www/check_job_status.psp +++ b/www/check_job_status.psp @@ -1,7 +1,7 @@ <% __author__ = "Jesse Stombaugh" __copyright__ = "Copyright 2009-2010, Qiime Web Analysis" -__credits__ = ["Doug Wendel"] +__credits__ = ["Doug Wendel", "Zhenjiang Xu"] __license__ = "GPL" __version__ = "1.0.0.dev" __maintainer__ = ["Doug Wendel"] @@ -40,7 +40,34 @@ else: raise('Could not determine job identifier. study_id and meta_analysis_id are both empty.') job_type_ids = form['job_type_id'].split(',') +# queued_data_load = form['queued_data_load'] +if 'queued_data_load' in form: + jobs_3 = data_access.getJobInfo(study_id, 3) + ready = True + if jobs_3: + for job in jobs_3: + if job['job_state_name'] != 'COMPLETED_OKAY': + # if any job of preprocess is not finished with ok + ready = False + break + else: ready = False + if ready: + link = '(submit all jobs)' + for job in data_access.getJobInfo(study_id, 12): + if job['job_state_name'] in ['COMPLETED_OKAY', 'COMPLETING', + 'QUEUED', 'NEW', 'RUNNING', 'EXITING']: + # not allowing submit jobs for these statuses + link = '' + break + # +%> +
  • Queued Data to Load <%=link%> + +
  • +<% # %> diff --git a/www/js/jobs.js b/www/js/jobs.js old mode 100644 new mode 100755 index b7719ae0..4a17b03b --- a/www/js/jobs.js +++ b/www/js/jobs.js @@ -35,37 +35,6 @@ function GetXmlHttpObject() return null; } -function submitAllJobs() -{ - // check if browser can perform xmlhttp - xmlhttp = GetXmlHttpObject() - if (xmlhttp==null) - { - alert ("Your browser does not support XML HTTP Request"); - return; - } - - var span_name ="submit_all_span"; - var url = "load_study.psp"; - - xmlhttp.onreadystatechange=function() - { - if (xmlhttp.readyState==4) - { - try - { - document.getElementById(span_name).innerHTML = xmlhttp.responseText; - } - catch(e) - { - // Do nothing - } - } - } - // perform a GET - xmlhttp.open("GET", url, true); - xmlhttp.send(null); -} function checkQiimeJobLoadStatus() { @@ -78,7 +47,7 @@ function checkQiimeJobLoadStatus() } div_name ="qiime_load_status_div"; - var url = "check_job_status.psp?job_type_id=12,15"; + var url = "check_job_status.psp?job_type_id=12&queued_data_load"; xmlhttp.onreadystatechange=function() { @@ -286,7 +255,6 @@ function checkAllStudyJobs() setTimeout(checkQiimeJobStatus, 0); setTimeout(checkQiimeJobLoadStatus, 1000); setTimeout(checkEBISRAJobStatus, 2000); - setTimeout(submitAllJobs, 3000); } function confirmFormSubmission(confirm_message, form_name) diff --git a/www/load_study.psp b/www/load_study.psp deleted file mode 100644 index 513bfb48..00000000 --- a/www/load_study.psp +++ /dev/null @@ -1,38 +0,0 @@ -<% -__author__ = "Zhenjiang Xu" -__copyright__ = "Copyright 2009-2010, Qiime Web Analysis" -__credits__ = ["Zhenjiang Xu"] -__license__ = "GPL" -__version__ = "1.0.0.dev" -__maintainer__ = ["Zhenjiang Xu"] -__email__ = "zhenjiang.xu@colorado.edu" -__status__ = "Development" -%> - -<% -from data_access_connections import data_access_factory -from enums import ServerConfig -# Grab some required values for this page -sess = Session.Session(req) - -data_access = data_access_factory(ServerConfig.data_access_type) - -study_id = sess['study_id'] - -ready = True -for job in data_access.getJobInfo(study_id, 3): - if not job['job_state_name'] == 'COMPLETED_OKAY': - ready = False - break -if ready: - ready = False - for job in data_access.getJobInfo(study_id, 12): - if not job['job_state_name'] in ['COMPLETED_OKAY', 'COMPLETING', 'QUEUED', 'NEW', 'RUNNING']: - ready = True - break - -if ready: - req.write('(submit all jobs)') - -req.write('
    ') -%> diff --git a/www/select_study_task.psp b/www/select_study_task.psp index d441271d..afcac271 100644 --- a/www/select_study_task.psp +++ b/www/select_study_task.psp @@ -214,7 +214,7 @@ if portal_type in ['qiime', 'emp']: -
    + <% elif metadata_complete == 'y' and sff_complete == 'y' and web_app_user_id in approved_qiime_submitters: if sess["form"].has_key("message"): @@ -266,27 +266,12 @@ if portal_type in ['qiime', 'emp']:
  • Submit Job to Qiime (complete sequence and metadata upload first)
  • <% if is_admin == 1: - #jobs = data_access.getJobInfo(study_id, 12) # Jobs refers to qiime submission jobs. If this is populated, activate this # div and watch for loading jobs to appear - if len(jobs) > 0: - # indent %> -
  • - Queued Data to Load - - -
    +
    <% # End if -%> -
  • - -<% # End if