~ubuntu-branches/debian/sid/boinc/sid

« back to all changes in this revision

Viewing changes to sched/validator.cpp

  • Committer: Package Import Robot
  • Author(s): Steffen Moeller
  • Date: 2011-08-08 01:36:51 UTC
  • mfrom: (6.1.11 experimental)
  • Revision ID: package-import@ubuntu.com-20110808013651-m1hs3cltiveuteyn
Tags: 6.13.1+dfsg-2
* Bringing notify patch to unstable.
* Adjusted build dependency to libjpeg-dev (Closes: #641093)
* Further improvements on stripchart.

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
        retval = credited_job.insert();
120
120
        if (retval) {
121
121
            log_messages.printf(MSG_CRITICAL,
122
 
                "[RESULT#%d] Warning: credited_job insert failed (userid: %d workunit: %f err: %d)\n",
123
 
                result.id, host.userid, wu.opaque, retval
 
122
                "[RESULT#%d] Warning: credited_job insert failed (userid: %d workunit: %f err: %s)\n",
 
123
                result.id, host.userid, wu.opaque, boincerror(retval)
124
124
            );
125
125
        } else {
126
126
            log_messages.printf(MSG_DEBUG,
202
202
             );
203
203
 
204
204
            check_pair(result, canonical_result, retry);
205
 
            if (retry) transition_time = DELAYED;
 
205
            if (retry) {
 
206
                // this usually means an NFS mount has failed;
 
207
                // arrange to try again later.
 
208
                //
 
209
                transition_time = DELAYED;
 
210
                goto leave;
 
211
            }
206
212
            update_result = false;
207
213
 
208
214
            if (result.outcome == RESULT_OUTCOME_VALIDATE_ERROR) {
218
224
            retval = host.lookup_id(result.hostid);
219
225
            if (retval) {
220
226
                log_messages.printf(MSG_CRITICAL,
221
 
                    "[RESULT#%d] lookup of host %d failed %d\n",
222
 
                    result.id, result.hostid, retval
 
227
                    "[RESULT#%d] lookup of host %d failed: %s\n",
 
228
                    result.id, result.hostid, boincerror(retval)
223
229
                );
224
230
                continue;
225
231
            }
249
255
                retval = is_valid(host, result, wu, havv[0]);
250
256
                if (retval) {
251
257
                    log_messages.printf(MSG_NORMAL,
252
 
                        "[RESULT#%d %s] is_valid() error: %d\n",
253
 
                        result.id, result.name, retval
 
258
                        "[RESULT#%d %s] is_valid() error: %s\n",
 
259
                        result.id, result.name, boincerror(retval)
254
260
                    );
255
261
                }
256
262
                // do credit computation, but grant credit of canonical result
260
266
                    wu, rv, app, app_versions, havv, max_granted_credit, credit
261
267
                );
262
268
                result.granted_credit = canonical_result.granted_credit;
263
 
                grant_credit(
264
 
                    host, result.sent_time, result.cpu_time,
265
 
                    result.granted_credit
266
 
                );
 
269
                grant_credit(host, result.sent_time, result.granted_credit);
267
270
                break;
268
271
            case VALIDATE_STATE_INVALID:
269
272
                update_result = true;
287
290
                retval = validator.update_result(result);
288
291
                if (retval) {
289
292
                    log_messages.printf(MSG_CRITICAL,
290
 
                        "[RESULT#%d %s] Can't update result: %d\n",
291
 
                        result.id, result.name, retval
 
293
                        "[RESULT#%d %s] Can't update result: %s\n",
 
294
                        result.id, result.name, boincerror(retval)
292
295
                    );
293
296
                }
294
297
            }
340
343
            );
341
344
 
342
345
            double dummy;
343
 
            retval = check_set(
344
 
                results, wu, canonicalid, dummy, retry
345
 
            );
 
346
            retval = check_set(results, wu, canonicalid, dummy, retry);
346
347
            if (retval) {
347
348
                log_messages.printf(MSG_CRITICAL,
348
 
                    "[WU#%d %s] check_set returned %d, exiting\n",
349
 
                    wu.id, wu.name, retval
 
349
                    "[WU#%d %s] check_set() error: %s, exiting\n",
 
350
                    wu.id, wu.name, boincerror(retval)
350
351
                );
351
352
                return retval;
352
353
            }
356
357
                retval = get_credit_from_wu(wu, results, credit);
357
358
                if (retval) {
358
359
                    log_messages.printf(MSG_CRITICAL,
359
 
                        "[WU#%d %s] get_credit_from_wu returned %d\n",
360
 
                        wu.id, wu.name, retval
 
360
                        "[WU#%d %s] get_credit_from_wu(): credit not specified in WU\n",
 
361
                        wu.id, wu.name
361
362
                    );
362
 
                    return retval;
 
363
                    credit = 0;
363
364
                }
364
 
            }
365
 
 
366
 
            if (canonicalid) {
367
 
                retval = assign_credit_set(
368
 
                    wu, results, app, app_versions, host_app_versions,
369
 
                    max_granted_credit, credit
370
 
                );
371
 
                if (retval) {
372
 
                    log_messages.printf(MSG_CRITICAL,
373
 
                        "[WU#%d %s] assign_credit_set() returned %d\n",
374
 
                        wu.id, wu.name, retval
 
365
            } else {
 
366
                if (canonicalid) {
 
367
                    retval = assign_credit_set(
 
368
                        wu, results, app, app_versions, host_app_versions,
 
369
                        max_granted_credit, credit
375
370
                    );
376
 
                    transition_time = DELAYED;
377
 
                    goto leave;
 
371
                    if (retval) {
 
372
                        log_messages.printf(MSG_CRITICAL,
 
373
                            "[WU#%d %s] assign_credit_set(): %s\n",
 
374
                            wu.id, wu.name, boincerror(retval)
 
375
                        );
 
376
                        transition_time = DELAYED;
 
377
                        goto leave;
 
378
                    }
378
379
                }
379
380
            }
380
381
 
410
411
                    retval = host.lookup_id(result.hostid);
411
412
                    if (retval) {
412
413
                        log_messages.printf(MSG_CRITICAL,
413
 
                            "[RESULT#%d] lookup of host %d failed %d\n",
414
 
                            result.id, result.hostid, retval
 
414
                            "[RESULT#%d] lookup of host %d: %s\n",
 
415
                            result.id, result.hostid, boincerror(retval)
415
416
                        );
416
417
                        continue;
417
418
                    }
425
426
                    retval = is_valid(host, result, wu, host_app_versions[i]);
426
427
                    if (retval) {
427
428
                        log_messages.printf(MSG_DEBUG,
428
 
                            "[RESULT#%d %s] is_valid() failed: %d\n",
429
 
                            result.id, result.name, retval
 
429
                            "[RESULT#%d %s] is_valid() failed: %s\n",
 
430
                            result.id, result.name, boincerror(retval)
430
431
                        );
431
432
                    }
432
 
                    grant_credit(
433
 
                        host, result.sent_time, result.cpu_time,
434
 
                        result.granted_credit
435
 
                    );
 
433
                    result.granted_credit = credit;
 
434
                    grant_credit(host, result.sent_time, credit);
436
435
                    log_messages.printf(MSG_NORMAL,
437
436
                        "[RESULT#%d %s] Valid; granted %f credit [HOST#%d]\n",
438
437
                        result.id, result.name, result.granted_credit,
468
467
                    retval = validator.update_result(result);
469
468
                    if (retval) {
470
469
                        log_messages.printf(MSG_CRITICAL,
471
 
                            "[RESULT#%d %s] result.update() failed: %d\n",
472
 
                            result.id, result.name, retval
 
470
                            "[RESULT#%d %s] result.update() failed: %s\n",
 
471
                            result.id, result.name, boincerror(retval)
473
472
                        );
474
473
                    }
475
474
                }
503
502
                    retval = validator.update_result(result);
504
503
                    if (retval) {
505
504
                        log_messages.printf(MSG_CRITICAL,
506
 
                            "[RESULT#%d %s] result.update() failed: %d\n",
507
 
                            result.id, result.name, retval
 
505
                            "[RESULT#%d %s] result.update() failed: %s\n",
 
506
                            result.id, result.name, boincerror(retval)
508
507
                        );
509
508
                    }
510
509
                }
554
553
    retval = validator.update_workunit(wu);
555
554
    if (retval) {
556
555
        log_messages.printf(MSG_CRITICAL,
557
 
            "[WU#%d %s] update_workunit() failed: %d; exiting\n",
558
 
            wu.id, wu.name, retval
 
556
            "[WU#%d %s] update_workunit() failed: %s; exiting\n",
 
557
            wu.id, wu.name, boincerror(retval)
559
558
        );
560
559
        return retval;
561
560
    }
602
601
        config.db_name, config.db_host, config.db_user, config.db_passwd
603
602
    );
604
603
    if (retval) {
605
 
        log_messages.printf(MSG_CRITICAL, "boinc_db.open failed: %d\n", retval);
 
604
        log_messages.printf(MSG_CRITICAL,
 
605
            "boinc_db.open failed: %s\n", boincerror(retval)
 
606
        );
606
607
        exit(1);
607
608
    }
608
609
 
645
646
    int i, retval;
646
647
 
647
648
    const char *usage = 
648
 
      "\nUsage: %s -app <app-name> [OPTIONS]\n"
 
649
      "\nUsage: %s --app <app-name> [OPTIONS]\n"
649
650
      "Start validator for application <app-name>\n\n"
650
651
      "Optional arguments:\n"
651
652
      "  --one_pass_N_WU N       Validate at most N WUs, then exit\n"
738
739
    main_loop();
739
740
}
740
741
 
741
 
const char *BOINC_RCSID_634dbda0b9 = "$Id: validator.cpp 22418 2010-09-28 20:17:09Z davea $";
 
742
const char *BOINC_RCSID_634dbda0b9 = "$Id: validator.cpp 23506 2011-05-05 14:56:32Z davea $";