Пример #1
0
 void replica::on_check_timer()
 {
     init_checkpoint();
     gc();
 }
Пример #2
0
int main(int argc, char **argv)
{
    debug_config(progname);

    // By default, turn on fast abort option since we know each job is of very similar size (in terms of runtime).
    // One can also set the fast_abort_multiplier by the '-f' option.
    wq_option_fast_abort_multiplier = 10;

    get_options(argc, argv, progname);

    outfile = fopen(outfilename, "a+");
    if(!outfile) {
        fprintf(stderr, "%s: couldn't open %s: %s\n", progname, outfilename, strerror(errno));
        exit(1);
    }

    if(!find_executable(filter_program_name, "PATH", filter_program_path, sizeof(filter_program_path))) {
        fprintf(stderr, "%s: couldn't find %s in your PATH.\n", progname, filter_program_path);
        exit(1);
    }

    if(work_queue_master_mode == WORK_QUEUE_MASTER_MODE_CATALOG && !project) {
        fprintf(stderr, "sand_filter: sand filter master running in catalog mode. Please use '-N' option to specify the name of this project.\n");
        fprintf(stderr, "sand_filter: Run \"%s -h\" for help with options.\n", argv[0]);
        return 1;
    }

    q = work_queue_create(port);
    if(!q) {
        fprintf(stderr, "%s: couldn't listen on port %d: %s\n", progname, port, strerror(errno));
        exit(1);
    }

    port = work_queue_port(q);

    if(port_file) {
        opts_write_port_file(port_file,port);
    }

    // advanced work queue options
    work_queue_specify_master_mode(q, work_queue_master_mode);
    work_queue_specify_name(q, project);
    work_queue_specify_priority(q, priority);

    load_sequences(sequence_filename);
    debug(D_DEBUG, "Sequence loaded.\n", curr_rect_y, curr_rect_x);

    init_checkpoint();

    start_time = time(0);

    int curr_start_x = 0, curr_start_y = 0, curr_rect_x = 0, curr_rect_y = 0;

    while(1) {
        while(work_queue_hungry(q)) {
            if(curr_start_y >= num_seqs)
                break;

            display_progress();

            if(checkpoint[curr_rect_y][curr_rect_x] != CHECKPOINT_STATUS_SUCCESS)
                task_submit(q, curr_rect_x, curr_rect_y);

            // Increment the x rectangle
            curr_rect_x++;
            curr_start_x += rectangle_size;

            // If we've reached the end of a row, move to the
            // next row by incrementing the y rectangle.
            if(curr_start_x >= num_seqs) {
                curr_rect_y++;
                curr_start_y += rectangle_size;
                curr_rect_x = curr_rect_y;
                curr_start_x = curr_rect_x * rectangle_size;
            }
        }

        if(work_queue_empty(q) && curr_start_y >= num_seqs)
            break;

        struct work_queue_task *t = work_queue_wait(q, 5);
        if(t)
            task_complete(t);

        display_progress();
    }

    printf("%s: candidates generated: %lu\n", progname, cand_count);

    if(checkpoint_file) {
        fclose(checkpoint_file);
    }

    fprintf(outfile, "EOF\n");
    fclose(outfile);

    work_queue_delete(q);

    if(!do_not_unlink)
        delete_dir(outdirname);

    return 0;
}
Пример #3
0
 void replica::on_checkpoint_timer()
 {
     check_hashed_access();
     init_checkpoint();
     garbage_collection();
 }