diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -189,6 +189,32 @@ void mortition(struct distrenjob *head, } } +/** scans the frames of a job to initialize a job after server */ +/* returns 1 if the job is completely done and there are no missing frames */ +/* returns 0 if a missing frame is found */ +int restoreJobState(struct distrenjob *job) +{ + short int isJobDone; + int counter; + char *path_and_number; + struct stat buffer; + + isJobDone = 1; + for(counter = 0; counter < job->total_frames; counter++) + { + _distren_asprintf(&path_and_number, "stor/job%d/out/%d.%s", job->jobnum, job->frameset[counter].num, job->output_format); + if(stat(path_and_number, &buffer) == 0) + { + job->frameset[counter].status = FRAMESETSTATUS_ASSIGNED; + job->completed_frames++; + } + else + isJobDone = 0; + } + + return isJobDone; +} + /** creates a structure from starting data, then calls another function to actually add that struct to the queue */ void prepare_distrenjob(struct distrenjob *head, int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame) {