instead of from when the pipeline was started.
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)
# 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
from htsworkflow.frontend.experiments.models import *
from htsworkflow.frontend.experiments.experiments import \
estimateFlowcellDuration, \
+ estimateFlowcellTimeRemaining, \
+ roundToDays, \
getUsersForFlowcell, \
makeEmailLaneMap
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
u'runfolder': 'blank',
u'finish_low': estimate_low,
u'finish_high': estimate_high,
+ u'now': datetime.now(),
})
# build view
{% endfor %}</p>
<p>
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" }}
</p>
<p>
<a href="https://jumpgate.caltech.edu/runfolders/cellcenter/">
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/