Skip to content

Commit

Permalink
Starting Job Execution in separate thread
Browse files Browse the repository at this point in the history
Fixes: bug #1228140

Change-Id: I0676ba811d1d67a229b710baa0036f5a24c723e1
  • Loading branch information
Konovalov-Nik authored and Frostman committed Oct 7, 2013
1 parent e8f8fe5 commit 9580517
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion savanna/service/edp/api.py
Expand Up @@ -35,7 +35,10 @@ def execute_job(job_id, input_id, output_id, cluster_id, configs):
'job_id': job_id, 'cluster_id': cluster_id,
'info': {'status': 'Pending'}, 'job_configs': configs}
job_execution = conductor.job_execution_create(context.ctx(), job_ex_dict)
return manager.run_job(context.ctx(), job_execution)

context.spawn("Starting Job Execution %s" % job_execution.id,
manager.run_job, job_execution)
return job_execution


def get_job_execution_status(id):
Expand Down
6 changes: 4 additions & 2 deletions savanna/service/edp/job_manager.py
Expand Up @@ -95,12 +95,14 @@ def cancel_job(job_execution_id):
return job_execution


def run_job(ctx, job_execution):
def run_job(job_execution):
ctx = context.ctx()

cluster = conductor.cluster_get(ctx, job_execution.cluster_id)
if cluster.status != 'Active':
return job_execution

job = conductor.job_get(context.ctx(), job_execution.job_id)
job = conductor.job_get(ctx, job_execution.job_id)
input_source = conductor.data_source_get(ctx, job_execution.input_id)
output_source = conductor.data_source_get(ctx, job_execution.output_id)
#TODO(nprivalova): should be removed after all features implemented
Expand Down

0 comments on commit 9580517

Please sign in to comment.