From: Diane Trout Date: Tue, 10 Nov 2009 02:06:26 +0000 (+0000) Subject: Remport that the pipeline will be done in X to Y days from now X-Git-Tag: 0.4.0~37 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=f1e43a894b2447b87f5f9d4cc6a872fd9aaac7a9 Remport that the pipeline will be done in X to Y days from now instead of from when the pipeline was started. --- diff --git a/htsworkflow/frontend/experiments/experiments.py b/htsworkflow/frontend/experiments/experiments.py index 7e6c734..4d9dac1 100755 --- a/htsworkflow/frontend/experiments/experiments.py +++ b/htsworkflow/frontend/experiments/experiments.py @@ -256,10 +256,26 @@ def estimateFlowcellDuration(flowcell): sequencing_time = timedelta(0, cycles * sequencing_seconds_per_cycle) analysis_time = timedelta(0, cycles * pipeline_seconds_per_cycle) estimate_mid = sequencing_time + analysis_time + + return estimate_mid + +def estimateFlowcellTimeRemaining(flowcell): + estimate_mid = estimateFlowcellDuration(flowcell) + + # offset for how long we've been running + running_time = datetime.now() - flowcell.run_date + estimate_mid -= running_time + + return estimate_mid + +def roundToDays(estimate): + """ + Given a time estimate round up and down in days + """ # floor estimate_mid - estimate_low = timedelta(estimate_mid.days, 0) + estimate_low = timedelta(estimate.days, 0) # floor estimate_mid and add a day - estimate_high = timedelta(estimate_mid.days+1, 0) + estimate_high = timedelta(estimate.days+1, 0) return (estimate_low, estimate_high) diff --git a/htsworkflow/frontend/experiments/views.py b/htsworkflow/frontend/experiments/views.py index e03c038..e2f6d88 100755 --- a/htsworkflow/frontend/experiments/views.py +++ b/htsworkflow/frontend/experiments/views.py @@ -1,4 +1,6 @@ # Create your views here. +from datetime import datetime + #from django.template import Context, loader #shortcut to the above modules from django.contrib.auth.decorators import user_passes_test @@ -12,6 +14,8 @@ from django.template.loader import get_template from htsworkflow.frontend.experiments.models import * from htsworkflow.frontend.experiments.experiments import \ estimateFlowcellDuration, \ + estimateFlowcellTimeRemaining, \ + roundToDays, \ getUsersForFlowcell, \ makeEmailLaneMap @@ -64,7 +68,8 @@ def startedEmail(request, pk): email_lane = makeEmailLaneMap(fc) flowcell_users = getUsersForFlowcell(fc) - estimate_low, estimate_high = estimateFlowcellDuration(fc) + estimate = estimateFlowcellTimeRemaining(fc) + estimate_low, estimate_high = roundToDays(estimate) email_verify = get_template('experiments/email_preview.html') email_template = get_template('experiments/started_email.txt') sender = settings.NOTIFICATION_SENDER @@ -87,6 +92,7 @@ def startedEmail(request, pk): u'runfolder': 'blank', u'finish_low': estimate_low, u'finish_high': estimate_high, + u'now': datetime.now(), }) # build view diff --git a/htsworkflow/frontend/templates/experiments/started_email.html b/htsworkflow/frontend/templates/experiments/started_email.html index d75e4f1..dcb2df0 100644 --- a/htsworkflow/frontend/templates/experiments/started_email.html +++ b/htsworkflow/frontend/templates/experiments/started_email.html @@ -10,8 +10,8 @@ Lane #{{ lane.lane_number }} : {% endfor %}

The data should be available at the following link when -the pipeline finishes, probably in about -{{ finish_low.days }} to {{ finish_high.days }} days after the flowcell is started. +the pipeline finishes, probably in about {{ finish_low.days }} to {{ finish_high.days }} +days from {{ now|date:"D, M d Y" }}

diff --git a/htsworkflow/frontend/templates/experiments/started_email.txt b/htsworkflow/frontend/templates/experiments/started_email.txt index 9b11a74..b2212e0 100644 --- a/htsworkflow/frontend/templates/experiments/started_email.txt +++ b/htsworkflow/frontend/templates/experiments/started_email.txt @@ -7,9 +7,9 @@ Lane #{{ lane.lane_number }} : ({{ lane.library.id }}) {{ lane.library.library_n http://jumpgate.caltech.edu/library/{{ lane.library.id }} {% endfor %} -The raw data should be available at the following link when -the pipeline finishes, probably in about -{{ finish_low.days }} to {{ finish_high.days }} days after the flowcell is started. +The raw data should be available at the following link when the +pipeline finishes, probably in about {{ finish_low.days }} to {{ finish_high.days }} +days from {{ now|date:"D, M d Y" }} http://jumpgate.caltech.edu/runfolders/cellcenter/