Commit e05a863c authored by root's avatar root

server: debug task / display scheduler run status

parent 9e1210fe
......@@ -70,11 +70,9 @@ def run_request():
if len(row) > 0 : ## update
data_id = row[0].id
db.data_file[data_id] = dict(status = 'queued')
else: ## create
data_id = db.data_file.insert(sequence_file_id = request.vars['sequence_file_id'],
config_id = request.vars['config_id'],
status = 'pending'
)
## create or update fuse file state
......@@ -89,8 +87,9 @@ def run_request():
config_id = request.vars['config_id'])
##add task to scheduller
scheduler.queue_task('run', [request.vars["sequence_file_id"],request.vars["config_id"], data_id, fuse_id]
task = scheduler.queue_task('run', [request.vars["sequence_file_id"],request.vars["config_id"], data_id, fuse_id]
, repeats = 1, timeout = 6000)
db.data_file[data_id] = dict(scheduler_task_id = task.id)
(filename, str) = db.sequence_file.data_file.retrieve(db.sequence_file[request.vars["sequence_file_id"]].data_file)
config_name = db.config[request.vars["config_id"]].name
......
......@@ -128,7 +128,7 @@ db.define_table('data_file',
Field('sequence_file_id', 'reference sequence_file'),
Field('config_id', 'reference config'),
Field('run_date','date'),
Field('status', 'string'),
Field('scheduler_task_id', 'integer'),
Field('data_file', 'upload', length=1000000000000))
db.define_table('fused_file',
......
......@@ -39,7 +39,7 @@ def run_vidjil(id_file, id_config, id_data, id_fuse):
## insertion dans la base de donnée
ts = time.time()
db.data_file[id_data] = dict(status = 'ready',
db.data_file[id_data] = dict(status = "ready",
run_date = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d'),
data_file = stream
)
......@@ -55,13 +55,14 @@ def run_vidjil(id_file, id_config, id_data, id_fuse):
& ( db.data_file.config_id == id_config )
).select( orderby=db.sequence_file.sampling_date )
for row in query :
files += sys.path[0] + "applications/vidjil/uploads/"+row.data_file.data_file
if row.data_file.data_file is not None :
files += os.path.abspath(os.path.dirname(sys.argv[0])) + "/applications/vidjil/uploads/"+row.data_file.data_file
cmd = "python ../fuse.py -o "+output_file+" -t 100 -g "+vidjil_germline+" "+files
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
p.wait()
fuse_filepath = os.path.abspath(output_file)
stream = open(fuse_filepath, 'rb')
......
......@@ -35,6 +35,7 @@
{{fused_count = 0}}
{{pass}}
{{
query = db(
(db.sequence_file.patient_id==db.patient.id)
......@@ -46,6 +47,7 @@ query = db(
)
)
}}
<div>
<h3>{{=patient.last_name + " " + patient.first_name}} ({{=request.vars["id"]}})</h3>
......@@ -97,6 +99,12 @@ query = db(
{{else:}}
{{(filename, str) = db.sequence_file.data_file.retrieve(row.sequence_file.data_file)}}
{{pass}}
{{if row.data_file.scheduler_task_id is None :}}
{{status = '' }}
{{else:}}
{{status = db.scheduler_task[row.data_file.scheduler_task_id ].status }}
{{pass}}
<tr>
<td id="sequence_file_{{=row.sequence_file.id}}"> {{=filename}}</td>
......@@ -111,10 +119,10 @@ query = db(
<td> {{if row.data_file.run_date :}}{{=row.data_file.run_date }}{{pass}} </td>
<td>
{{if filename != '' and config_id != -1:}}
{{if row.data_file.id == None or row.data_file.status == "ready" :}}
{{if row.data_file.id == None or status == "COMPLETED" :}}
<span class="button" onclick="db.call('default/run_request', { 'sequence_file_id' : '{{=row.sequence_file.id}}', 'config_id' : {{=config_id}} } )"> run >> </span>
{{else:}}
{{=row.data_file.status}}
{{=status}}
{{pass}}
{{pass}}
</td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment