| 6 | |
| 7 | Users can submit jobs only if they have been given access |
| 8 | (via a web interface) by project administrators. |
| 9 | |
| 10 | In addition, project admins can restrict the apps for which |
| 11 | each user is allowed to submit jobs. |
| 12 | |
| 13 | == PHP interface == |
| 14 | |
| 15 | === boinc_estimate_batch() === |
| 16 | |
| 17 | This function returns an estimate of the elapsed time |
| 18 | required to complete a given batch. |
| 19 | |
| 20 | Arguments: a "request object" whose fields include |
| 21 | * '''project''': the project URL |
| 22 | * '''authenticator''': the user's authenticator |
| 23 | * '''app_name''': the name of the application for which jobs are being submitted |
| 24 | * '''jobs''': an array of job descriptors (see example) |
| 25 | |
| 26 | Return value: a 2-element array containing |
| 27 | * The estimate (in seconds) |
| 28 | * An error message (null if success) |
| 29 | |
| 30 | Example: |
| 31 | {{{ |
| 32 | $req->project = "http://foo.bar.edu/test/"; |
| 33 | $req->authenticator = "xxx"; |
| 34 | $req->app_name = "uppercase"; |
| 35 | $req->jobs = array(); |
| 36 | |
| 37 | $f->source = "http://foo.bar.edu/index.php"; |
| 38 | $f->name = "in"; |
| 39 | $job->input_files = array($f); |
| 40 | |
| 41 | for ($i=10; $i<20; $i++) { |
| 42 | $job->rsc_fpops_est = $i*1e9; |
| 43 | $job->command_line = "--t $i"; |
| 44 | $req->jobs[] = $job; |
| 45 | } |
| 46 | |
| 47 | list($e, $errmsg) = boinc_estimate_batch($req); |
| 48 | }}} |
| 49 | |
| 50 | === boinc_submit_batch() === |
| 51 | |
| 52 | Similar to '''boinc_estimate_batch()''', but submits the batch. |
| 53 | The return value is a 2-element array containing |
| 54 | * The batch ID |
| 55 | * An error message (null if success) |
| 56 | |
| 57 | === boinc_query_batches() === |
| 58 | === boinc_query_batch() === |
| 59 | === boinc_abort_batch() === |
| 60 | |
| 61 | == HTTPS/XML interface == |
| 62 | |
135 | | == Aborting jobs == |
136 | | |
137 | | Input: |
138 | | {{{ |
139 | | <abort_batch> |
140 | | <authenticator>X</authenticator> |
141 | | <batch_id>N</batch_id> |
142 | | </abort_batch> |
143 | | }}} |
144 | | |
145 | | Output: |
146 | | {{{ |
147 | | <aborted/> |
148 | | }}} |
149 | | |
150 | | == Access control == |
151 | | |
152 | | Users can submit jobs only if they have been |
153 | | given access (via a web interface) by project administrators. |
154 | | |
155 | | In addition, project admins can allow users to submit jobs for any app, |
156 | | or can designate which apps they can submit jobs to. |
157 | | |
158 | | == Example usage == |
159 | | PHP: |
160 | | |
161 | | {{{ |
162 | | $ch = curl_init("https://project.edu/job_control.php"); |
163 | | curl_setopt($ch, CURLOPT_POST, 1); |
164 | | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
165 | | curl_setopt($ch, CURLOPT_POSTFIELDS, "request= |
166 | | <batch_estimate> |
167 | | <batch> |
168 | | <app>myappname</app> |
169 | | <job> |
170 | | <command_line>--t ALPHA</command_line> |
171 | | </job> |
172 | | </batch> |
173 | | </batch_estimate> |
174 | | "); |
175 | | $reply = curl_exec($ch); |
176 | | if (!$reply) die("HTTP op failed\n"); |
177 | | $r = simplexml_load_string($reply); |
178 | | if (!$r) die("bad reply: $reply\n"); |
179 | | $name = $r->getName(); |
180 | | if ($name == 'estimate') { |
181 | | echo "estimate: ".(string)$r->seconds."\n"; |
182 | | } else if ($name == 'error') { |
183 | | foreach ($r->message as $msg) { |
184 | | echo "$msg\n"; |
185 | | } |
186 | | } else { |
187 | | die("bad reply\n"); |
188 | | } |
189 | | }}} |
| 163 | === Aborting a batch === |