mirror of https://github.com/BOINC/boinc.git
remote job submission: add optional "job params" for batchs
This lets you specify the rsc_* parameters and delay bound in the submit call.
This commit is contained in:
parent
20b634b0fd
commit
42979fc8f9
|
@ -201,7 +201,7 @@ function stage_files(&$jobs) {
|
|||
// submit a list of jobs with a single create_work command.
|
||||
//
|
||||
function submit_jobs(
|
||||
$jobs, $template, $app, $batch_id, $priority, $app_version_num,
|
||||
$jobs, $job_params, $app, $batch_id, $priority, $app_version_num,
|
||||
$input_template_filename, // batch-level; can also specify per job
|
||||
$output_template_filename
|
||||
) {
|
||||
|
@ -254,6 +254,21 @@ function submit_jobs(
|
|||
if ($app_version_num) {
|
||||
$cmd .= " --app_version_num $app_version_num";
|
||||
}
|
||||
if ($job_params->rsc_disk_bound) {
|
||||
$cmd .= " --rsc_disk_bound $job_params->rsc_disk_bound";
|
||||
}
|
||||
if ($job_params->rsc_fpops_est) {
|
||||
$cmd .= " --rsc_fpops_est $job_params->rsc_fpops_est";
|
||||
}
|
||||
if ($job_params->rsc_fpops_bound) {
|
||||
$cmd .= " --rsc_fpops_bound $job_params->rsc_fpops_bound";
|
||||
}
|
||||
if ($job_params->rsc_memory_bound) {
|
||||
$cmd .= " --rsc_memory_bound $job_params->rsc_memory_bound";
|
||||
}
|
||||
if ($job_params->delay_bound) {
|
||||
$cmd .= " --delay_bound $job_params->delay_bound";
|
||||
}
|
||||
$cmd .= " --stdin >$errfile 2>&1";
|
||||
$h = popen($cmd, "w");
|
||||
if ($h === false) {
|
||||
|
@ -367,7 +382,7 @@ function xml_get_jobs($r) {
|
|||
return $jobs;
|
||||
}
|
||||
|
||||
// $r is a simplexml object for the request message
|
||||
// $r is a simplexml object encoding the request message
|
||||
//
|
||||
function submit_batch($r) {
|
||||
xml_start_tag("submit_batch");
|
||||
|
@ -382,6 +397,10 @@ function submit_batch($r) {
|
|||
$njobs = count($jobs);
|
||||
$now = time();
|
||||
$app_version_num = (int)($r->batch->app_version_num);
|
||||
|
||||
// batch may or may not already exist.
|
||||
// If it does, make sure it's owned by this user
|
||||
//
|
||||
$batch_id = (int)($r->batch->batch_id);
|
||||
if ($batch_id) {
|
||||
$batch = BoincBatch::lookup_id($batch_id);
|
||||
|
@ -439,20 +458,20 @@ function submit_batch($r) {
|
|||
$batch = BoincBatch::lookup_id($batch_id);
|
||||
}
|
||||
|
||||
if ($r->batch->input_template_filename) {
|
||||
$input_template_filename = $r->batch->input_template_filename;
|
||||
} else {
|
||||
$input_template_filename = null;
|
||||
}
|
||||
$job_params = new StdClass;
|
||||
$job_params->rsc_disk_bound = (double) $r->job_params->rsc_disk_bound;
|
||||
$job_params->rsc_fpops_est = (double) $r->job_params->rsc_fpops_est;
|
||||
$job_params->rsc_fpops_bound = (double) $r->job_params->rsc_fpops_bound;
|
||||
$job_params->rsc_memory_bound = (double) $r->job_params->rsc_memory_bound;
|
||||
$job_params->delay_bound = (double) $r->job_params->delay_bound;
|
||||
// could add quorum-related stuff
|
||||
|
||||
if ($r->batch->output_template_filename) {
|
||||
$output_template_filename = $r->batch->output_template_filename;
|
||||
} else {
|
||||
$output_template_filename = null;
|
||||
}
|
||||
$input_template_filename = (string) $r->batch->input_template_filename;
|
||||
$output_template_filename = (string) $r->batch->output_template_filename;
|
||||
// possibly empty
|
||||
|
||||
submit_jobs(
|
||||
$jobs, $template, $app, $batch_id, $let, $app_version_num,
|
||||
$jobs, $job_params, $app, $batch_id, $let, $app_version_num,
|
||||
$input_template_filename,
|
||||
$output_template_filename
|
||||
);
|
||||
|
|
|
@ -397,6 +397,29 @@ int submit_jobs(
|
|||
vector<JOB> jobs,
|
||||
string& error_msg,
|
||||
int app_version_num
|
||||
) {
|
||||
JOB_PARAMS jp;
|
||||
return submit_jobs_params(
|
||||
project_url,
|
||||
authenticator,
|
||||
app_name,
|
||||
batch_id,
|
||||
jobs,
|
||||
error_msg,
|
||||
jp,
|
||||
app_version_num
|
||||
);
|
||||
}
|
||||
|
||||
int submit_jobs_params(
|
||||
const char* project_url,
|
||||
const char* authenticator,
|
||||
char app_name[256],
|
||||
int batch_id,
|
||||
vector<JOB> jobs,
|
||||
string& error_msg,
|
||||
JOB_PARAMS &job_params,
|
||||
int app_version_num
|
||||
) {
|
||||
char buf[1024], url[1024];
|
||||
sprintf(buf,
|
||||
|
@ -405,11 +428,23 @@ int submit_jobs(
|
|||
"<batch>\n"
|
||||
" <batch_id>%d</batch_id>\n"
|
||||
" <app_name>%s</app_name>\n"
|
||||
" <app_version_num>%d</app_version_num>\n",
|
||||
" <app_version_num>%d</app_version_num>\n"
|
||||
" <job_params>\n"
|
||||
" <rsc_disk_bound>%f</rsc_disk_bound>\n"
|
||||
" <rsc_fpops_est>%f</rsc_fpops_est>\n"
|
||||
" <rsc_fpops_bound>%f</rsc_fpops_bound>\n"
|
||||
" <rsc_memory_bound>%f</rsc_memory_bound>\n"
|
||||
" <delay_bound>%f</delay_bound>\n"
|
||||
" </job_params>\n",
|
||||
authenticator,
|
||||
batch_id,
|
||||
app_name,
|
||||
app_version_num
|
||||
app_version_num,
|
||||
job_params.rsc_disk_bound,
|
||||
job_params.rsc_fpops_est,
|
||||
job_params.rsc_fpops_bound,
|
||||
job_params.rsc_memory_bound,
|
||||
job_params.delay_bound
|
||||
);
|
||||
string request = buf;
|
||||
for (unsigned int i=0; i<jobs.size(); i++) {
|
||||
|
|
|
@ -69,6 +69,17 @@ struct JOB_STATUS {
|
|||
JOB_STATUS(){}
|
||||
};
|
||||
|
||||
struct JOB_PARAMS {
|
||||
// 0 means unspecified for all params
|
||||
double rsc_disk_bound;
|
||||
double rsc_fpops_est;
|
||||
double rsc_fpops_bound;
|
||||
double rsc_memory_bound;
|
||||
double delay_bound;
|
||||
JOB_PARAMS(): rsc_disk_bound(0), rsc_fpops_est(0),rsc_fpops_bound(0),
|
||||
rsc_memory_bound(0), delay_bound(0) {}
|
||||
};
|
||||
|
||||
struct QUERY_BATCH_SET_REPLY {
|
||||
double server_time; // server time at start of query
|
||||
std::vector<int> batch_sizes; // how many jobs in each of the queried batches
|
||||
|
@ -151,6 +162,17 @@ extern int submit_jobs(
|
|||
int app_version_num = 0
|
||||
);
|
||||
|
||||
extern int submit_jobs_params(
|
||||
const char* project_url,
|
||||
const char* authenticator,
|
||||
char app_name[256],
|
||||
int batch_id,
|
||||
std::vector<JOB> jobs,
|
||||
std::string& error_msg,
|
||||
JOB_PARAMS &job_params,
|
||||
int app_version_num
|
||||
);
|
||||
|
||||
extern int estimate_batch(
|
||||
const char* project_url,
|
||||
const char* authenticator,
|
||||
|
|
|
@ -24,6 +24,19 @@
|
|||
#include "sched_config.h"
|
||||
#include "boinc_db.h"
|
||||
|
||||
// default job parameters
|
||||
//
|
||||
#define DEFAULT_MIN_QUORUM 2
|
||||
#define DEFAULT_TARGET_NRESULTS 2
|
||||
#define DEFAULT_MAX_ERROR_RESULTS 3
|
||||
#define DEFAULT_MAX_TOTAL_RESULTS 10
|
||||
#define DEFAULT_MAX_SUCCESS_RESULTS 6
|
||||
#define DEFAULT_RSC_FPOPS_EST 3600.e9
|
||||
#define DEFAULT_RSC_FPOPS_BOUND 86400.e9
|
||||
#define DEFAULT_RSC_MEMORY_BOUND 5.e8
|
||||
#define DEFAULT_RSC_DISK_BOUND 1.e9
|
||||
#define DEFAULT_DELAY_BOUND 7.*86400
|
||||
|
||||
// describes an input file;
|
||||
// either an argument to create_work(),
|
||||
// or a <file_info> in input template
|
||||
|
|
|
@ -142,17 +142,18 @@ struct JOB_DESC {
|
|||
// defaults (in case they're not in WU template)
|
||||
//
|
||||
wu.id = 0;
|
||||
wu.min_quorum = 2;
|
||||
wu.target_nresults = 2;
|
||||
wu.max_error_results = 3;
|
||||
wu.max_total_results = 10;
|
||||
wu.max_success_results = 6;
|
||||
wu.rsc_fpops_est = 3600e9;
|
||||
wu.rsc_fpops_bound = 86400e9;
|
||||
wu.rsc_memory_bound = 5e8;
|
||||
wu.rsc_disk_bound = 1e9;
|
||||
wu.min_quorum = DEFAULT_MIN_QUORUM;
|
||||
wu.target_nresults = DEFAULT_TARGET_NRESULTS;
|
||||
wu.max_error_results = DEFAULT_MAX_ERROR_RESULTS;
|
||||
wu.max_total_results = DEFAULT_MAX_TOTAL_RESULTS;
|
||||
wu.max_success_results = DEFAULT_MAX_SUCCESS_RESULTS;
|
||||
wu.rsc_fpops_est = DEFAULT_RSC_FPOPS_EST;
|
||||
wu.rsc_fpops_bound = DEFAULT_RSC_FPOPS_BOUND;
|
||||
wu.rsc_memory_bound = DEFAULT_RSC_MEMORY_BOUND;
|
||||
wu.rsc_disk_bound = DEFAULT_RSC_DISK_BOUND;
|
||||
wu.rsc_bandwidth_bound = 0.0;
|
||||
wu.delay_bound = 7*86400;
|
||||
// Not used
|
||||
wu.delay_bound = DEFAULT_DELAY_BOUND;
|
||||
|
||||
}
|
||||
void create();
|
||||
|
|
Loading…
Reference in New Issue