-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjob.resubmit.inc
56 lines (45 loc) · 1.37 KB
/
job.resubmit.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
function _job_resubmit($jobId) {
$query = db_update('boa_jobs');
$tz = date_default_timezone_get();
date_default_timezone_set('America/Chicago');
$query->fields(array(
'submitted' => date('Y-m-d G:i:s'),
'compiler_status' => 0,
'hadoop_status' => 4,
'compiler_output' => null,
'hadoop_output' => null
));
date_default_timezone_set($tz);
$query->condition('id', $jobId);
$query->execute();
$query = db_update('boa_output');
$query->fields(array(
'length' => 0,
'web_result' => ''
));
$query->condition('id', $jobId);
$query->execute();
@system("/home/hadoop/hadoop-current/bin/hadoop fs -rmr /boa/$jobId/");
}
function boa_job_resubmit($jobId) {
global $user;
if (!isValidJob($jobId))
invalidJob($jobId);
$running = job_run_count($user->uid);
_job_resubmit($jobId);
drupal_set_message('Your job was re-submitted. Please note it can take several minutes to get results, depending on server load.');
if ($running > 0)
drupal_set_message(t('You have other job(s) running. This job will queue until those jobs finish or are stopped.'));
if (job_run_count() > 3)
drupal_set_message(t('Server load is currently high. It will take some time for this job to finish.'));
drupal_goto("boa/job/$jobId");
drupal_exit();
}
function _job_resubmit_rpc($jobId) {
if (!isValidJob($jobId))
invalidJob($jobId);
_job_resubmit($jobId);
return "";
}
?>