Files
@ 9f7b19e75f9b
Branch filter:
Location: DistRen/src/server/distrenjob.h
9f7b19e75f9b
4.1 KiB
text/plain
readded AC_DEFINE_DIR so that config files have stuff substituted properly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | /*
Copyright 2009 Nathan Phillip Brink, Ethan Zonca, Matthew Orlando
This file is a part of DistRen.
DistRen is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DistRen is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with DistRen. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DISTREN_DISTRENJOB_H
#define _DISTREN_DISTRENJOB_H
/**
This file stores the distrenjob and frameset structs and prototypes for some functions to manipulate/use these.
*/
#include <time.h> /*< clock_t, time_t */
typedef unsigned int jobnum_t;
/**
Stores Blender Job Info
*/
struct distrenjob
{
struct distrenjob *next; /*< next will be NULL unless if there is another distrenjob */
short int type; /*< 1:Blender, 2:something else */
char *name;
char *submitter;
char *email; /*< This should be looked up based on the value of submitter, not stored in this struct */
jobnum_t jobnum;
int width; /*< width in pixels of the frames to be rendered */
int height; /*< height in pixels of the frames to be rendered */
int priority; /*< 1 is lowest, 10 is highest, 0 means the job is done */
int completed_frames; /*< number of completed frames for stats/etc */
int assigned_frames; /*< number of assigned frames (that are not yet completed) for stats/etc */
int total_frames; /*< how many frames are in the animation for stats/etc (unassigned frames) */
int watchdog_forgiveness; /*< how many seconds till the frame is re-assigned (if client computer crashes etc); */
short int hibernate;
int prev_frame_index; /*< the position in the array of the last frame that was assigned */
time_t total_render_time; /*< total seconds of time spent on all the completed frames */
char *output_format; /*< currently is the file extension of the request output format. @todo make this mime-type based/not a string */
unsigned long int assigned_render_power;
struct frameset *frameset;
};
/**
Frameset Structure
*/
enum framesetstatus
{
FRAMESETSTATUS_CANCELED, /*< The use has canceled this frame */
FRAMESETSTATUS_UNASSIGNED, /*< The frame has not been assigned */
FRAMESETSTATUS_ASSIGNED, /*< The frame has been assigned */
FRAMESETSTATUS_DONE /*< The frame has completed rendering and the slave has returned the product to me */
};
struct frameset {
int num; /*< frame number to render */
char slave_name; /*< user that frame is assigned to */
enum framesetstatus status; /*< status of frame, 0= unassigned, 1= taken, 2= done */
clock_t start_time; /*< time the frame was started */
};
/*
related functions
*/
/**
@param distrenjob the address where we will store the pointer of a malloc()ed
distrenjob struct.
@param pathtoxml filename/pathname of the xml file to be read into a distrenjob struct
*/
int distrenjob_unserialize(struct distrenjob **distrenjob, char *pathtoxml);
/**
serialize a distrenjob into XML
@param distrenjob the address where we will store the pointer of a malloc()ed
distrenjob struct.
@param xmloutput filename/pathname of the xml file to be written
*/
int distrenjob_serialize(struct distrenjob *distrenjob, char *xmloutputpath);
/**
support function for distrenjob_unserialize() to help cleaning up a
struct distrenjob when it is incompletely initialized.
Also acts as a general-purpose struct distrenjob free()er ;-)
*/
void distrenjob_free(struct distrenjob **distrenjob);
/**
initializes an empty, pointless struct distrenjob. This
DOES run malloc() for you. It could return nonzero on error,
but there are no errors to have yet (except for nomem). This
sets all char* to NULL.
You have to initialize your own frameset.
*/
int distrenjob_new(struct distrenjob **distrenjob);
#endif
|