2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2003-07-03 00:48:43 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2003-07-03 00:48:43 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software 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 Lesser General Public License for more details.
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
// If you change anything, make sure you also change:
|
2004-07-14 20:55:26 +00:00
|
|
|
// client_types.C (to write and parse it)
|
2002-04-30 22:22:54 +00:00
|
|
|
// client_state.C (to cross-link objects)
|
|
|
|
//
|
|
|
|
|
2002-06-21 06:52:47 +00:00
|
|
|
#ifndef _CLIENT_TYPES_
|
|
|
|
#define _CLIENT_TYPES_
|
2002-08-22 20:23:24 +00:00
|
|
|
|
2003-10-16 19:03:49 +00:00
|
|
|
#include "cpp.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2005-12-16 03:45:01 +00:00
|
|
|
#if !defined(_WIN32) || defined(__CYGWIN32__)
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <stdio.h>
|
2003-07-03 05:01:29 +00:00
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
|
2004-04-18 18:40:13 +00:00
|
|
|
#include "md5_file.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "hostinfo.h"
|
2004-06-12 04:45:36 +00:00
|
|
|
#include "miofile.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2004-08-05 21:42:26 +00:00
|
|
|
#define P_LOW 1
|
|
|
|
#define P_MEDIUM 3
|
|
|
|
#define P_HIGH 5
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2005-10-03 18:05:58 +00:00
|
|
|
#define MAX_FILE_INFO_LEN 4096
|
|
|
|
#define MAX_SIGNATURE_LEN 4096
|
|
|
|
#define MAX_KEY_LEN 4096
|
|
|
|
|
2003-11-02 22:51:49 +00:00
|
|
|
// If the status is neither of these two,
|
|
|
|
// it will be an error code defined in error_numbers.h,
|
2004-03-25 22:24:33 +00:00
|
|
|
// indicating an unrecoverable error in the upload or download of the file,
|
|
|
|
// or that the file was too big and was deleted
|
2003-11-02 22:51:49 +00:00
|
|
|
//
|
|
|
|
#define FILE_NOT_PRESENT 0
|
|
|
|
#define FILE_PRESENT 1
|
|
|
|
|
|
|
|
class FILE_INFO {
|
|
|
|
public:
|
|
|
|
char name[256];
|
|
|
|
char md5_cksum[33];
|
|
|
|
double max_nbytes;
|
|
|
|
double nbytes;
|
|
|
|
double upload_offset;
|
|
|
|
bool generated_locally; // file is produced by app
|
|
|
|
int status;
|
|
|
|
bool executable; // change file protections to make executable
|
|
|
|
bool uploaded; // file has been uploaded
|
|
|
|
bool upload_when_present;
|
|
|
|
bool sticky; // don't delete unless instructed to do so
|
2004-09-10 00:41:48 +00:00
|
|
|
bool report_on_rpc; // include this in each scheduler request
|
2005-01-31 23:42:19 +00:00
|
|
|
bool marked_for_delete; // server requested delete;
|
|
|
|
// if not in use, delete even if sticky is true
|
|
|
|
// don't report to server even if report_on_rpc is true
|
2003-11-02 22:51:49 +00:00
|
|
|
bool signature_required; // true iff associated with app version
|
|
|
|
bool is_user_file;
|
2006-06-26 22:58:24 +00:00
|
|
|
bool is_project_file;
|
2006-06-20 22:03:15 +00:00
|
|
|
bool gzip_when_done;
|
|
|
|
// for output files: gzip file when done, and append .gz to its name
|
2004-07-14 20:55:26 +00:00
|
|
|
class PERS_FILE_XFER* pers_file_xfer; // nonzero if in the process of being up/downloaded
|
2004-07-13 23:51:09 +00:00
|
|
|
struct RESULT* result; // for upload files (to authenticate)
|
2004-07-14 20:55:26 +00:00
|
|
|
class PROJECT* project;
|
2003-11-02 22:51:49 +00:00
|
|
|
int ref_cnt;
|
2005-03-09 23:28:37 +00:00
|
|
|
std::vector<std::string> urls;
|
2003-11-02 22:51:49 +00:00
|
|
|
int start_url;
|
|
|
|
int current_url;
|
2005-10-03 18:05:58 +00:00
|
|
|
char signed_xml[MAX_FILE_INFO_LEN];
|
2004-08-11 09:42:29 +00:00
|
|
|
// if the file_info is signed (for uploadable files)
|
|
|
|
// this is the text that is signed
|
2004-10-11 01:44:02 +00:00
|
|
|
// Otherwise it is the FILE_INFO's XML descriptor
|
|
|
|
// (without enclosing <file_info> tags)
|
2005-10-03 18:05:58 +00:00
|
|
|
char xml_signature[MAX_SIGNATURE_LEN];
|
2004-08-11 09:42:29 +00:00
|
|
|
// ... and this is the signature
|
2005-10-03 18:05:58 +00:00
|
|
|
char file_signature[MAX_SIGNATURE_LEN];
|
2004-08-11 09:42:29 +00:00
|
|
|
// if the file itself is signed (for executable files)
|
|
|
|
// this is the signature
|
2004-06-30 18:17:21 +00:00
|
|
|
std::string error_msg; // if permanent error occurs during file xfer,
|
2003-11-02 22:51:49 +00:00
|
|
|
// it's recorded here
|
|
|
|
|
|
|
|
FILE_INFO();
|
|
|
|
~FILE_INFO();
|
2004-09-02 16:23:21 +00:00
|
|
|
void reset();
|
2003-11-02 22:51:49 +00:00
|
|
|
int set_permissions();
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse(MIOFILE&, bool from_server);
|
|
|
|
int write(MIOFILE&, bool to_server);
|
2004-07-13 23:51:09 +00:00
|
|
|
int write_gui(MIOFILE&);
|
2003-11-02 22:51:49 +00:00
|
|
|
int delete_file(); // attempt to delete the underlying file
|
2005-03-09 23:47:45 +00:00
|
|
|
const char* get_init_url(bool);
|
|
|
|
const char* get_next_url(bool);
|
|
|
|
const char* get_current_url(bool);
|
2005-03-09 23:28:37 +00:00
|
|
|
bool is_correct_url_type(bool, std::string&);
|
2006-03-30 22:21:18 +00:00
|
|
|
bool had_failure(int& failnum);
|
|
|
|
void failure_message(std::string&);
|
2004-07-06 18:31:56 +00:00
|
|
|
int merge_info(FILE_INFO&);
|
2005-04-12 22:53:35 +00:00
|
|
|
int verify_file(bool);
|
2006-06-20 22:03:15 +00:00
|
|
|
int gzip(); // gzip file and add .gz to name
|
2003-11-02 22:51:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Describes a connection between a file and a workunit, result, or application.
|
|
|
|
// In the first two cases,
|
|
|
|
// the app will either use open() or fopen() to access the file
|
|
|
|
// (in which case "open_name" is the name it will use)
|
|
|
|
// or the app will be connected by the given fd (in which case fd is nonzero)
|
|
|
|
//
|
|
|
|
struct FILE_REF {
|
|
|
|
char file_name[256];
|
|
|
|
char open_name[256];
|
|
|
|
int fd;
|
|
|
|
bool main_program;
|
|
|
|
FILE_INFO* file_info;
|
2004-07-06 18:31:56 +00:00
|
|
|
bool copy_file; // if true, core client will copy the file instead of linking
|
2006-10-20 20:21:33 +00:00
|
|
|
bool optional;
|
|
|
|
// for output files: app may not generate file;
|
|
|
|
// don't treat as error if file is missing.
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse(MIOFILE&);
|
|
|
|
int write(MIOFILE&);
|
2003-11-02 22:51:49 +00:00
|
|
|
};
|
|
|
|
|
2005-04-04 06:02:36 +00:00
|
|
|
// statistics at a specific day
|
|
|
|
//
|
2005-08-11 04:45:16 +00:00
|
|
|
struct DAILY_STATS {
|
2005-04-04 06:02:36 +00:00
|
|
|
double user_total_credit;
|
|
|
|
double user_expavg_credit;
|
|
|
|
double host_total_credit;
|
|
|
|
double host_expavg_credit;
|
|
|
|
double day;
|
2005-08-11 04:45:16 +00:00
|
|
|
|
|
|
|
void clear();
|
|
|
|
DAILY_STATS() {clear();}
|
|
|
|
int parse(FILE*);
|
2005-04-04 06:02:36 +00:00
|
|
|
};
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
class PROJECT {
|
|
|
|
public:
|
2003-02-28 23:14:18 +00:00
|
|
|
// the following items come from the account file
|
2002-06-21 06:52:47 +00:00
|
|
|
// They are a function only of the user and the project
|
|
|
|
//
|
2002-07-15 23:37:55 +00:00
|
|
|
char master_url[256]; // url of site that contains scheduler tags
|
|
|
|
// for this project
|
2002-04-30 22:22:54 +00:00
|
|
|
char authenticator[256]; // user's authenticator on this project
|
2004-06-30 18:17:21 +00:00
|
|
|
std::string project_prefs;
|
2003-11-28 19:19:11 +00:00
|
|
|
// without the enclosing <project_preferences> tags.
|
|
|
|
// May include <venue> elements
|
|
|
|
// This field is used only briefly: between handling a
|
|
|
|
// scheduler RPC reply and writing the account file
|
2004-06-30 18:17:21 +00:00
|
|
|
std::string project_specific_prefs;
|
2003-11-28 19:19:11 +00:00
|
|
|
// without enclosing <project_specific> tags
|
|
|
|
// Does not include <venue> elements
|
2004-09-27 19:44:40 +00:00
|
|
|
std::string gui_urls;
|
|
|
|
// GUI URLs, with enclosing <gui_urls> tags
|
2003-11-28 19:19:11 +00:00
|
|
|
double resource_share;
|
|
|
|
// project's resource share relative to other projects.
|
2004-10-01 08:15:58 +00:00
|
|
|
char host_venue[256];
|
2005-04-03 22:01:18 +00:00
|
|
|
// logically, this belongs in the client state file
|
|
|
|
// rather than the account file.
|
|
|
|
// But we need it in the latter in order to parse prefs.
|
2005-04-22 03:46:01 +00:00
|
|
|
bool using_venue_specific_prefs;
|
2002-06-21 06:52:47 +00:00
|
|
|
|
|
|
|
// the following items come from client_state.xml
|
|
|
|
// They may depend on the host as well as user and project
|
2003-05-13 18:55:07 +00:00
|
|
|
// NOTE: if you add anything, add it to copy_state_fields() also!!!
|
2002-06-21 06:52:47 +00:00
|
|
|
//
|
2005-03-09 23:28:37 +00:00
|
|
|
std::vector<std::string> scheduler_urls;
|
|
|
|
// where to find scheduling servers
|
2002-06-21 06:52:47 +00:00
|
|
|
char project_name[256]; // descriptive. not unique
|
2006-05-23 06:46:19 +00:00
|
|
|
char symstore[256]; // URL of symbol server (Windows)
|
2002-06-21 06:52:47 +00:00
|
|
|
char user_name[256];
|
2003-02-24 21:25:16 +00:00
|
|
|
char team_name[256];
|
2004-04-18 18:40:13 +00:00
|
|
|
char email_hash[MD5_LEN];
|
|
|
|
char cross_project_id[MD5_LEN];
|
2006-05-23 06:46:19 +00:00
|
|
|
double user_total_credit;
|
|
|
|
double user_expavg_credit;
|
|
|
|
double user_create_time;
|
2002-04-30 22:22:54 +00:00
|
|
|
int hostid;
|
2006-05-23 06:46:19 +00:00
|
|
|
double host_total_credit;
|
|
|
|
double host_expavg_credit;
|
|
|
|
double host_create_time;
|
2006-10-23 16:00:51 +00:00
|
|
|
double ams_resource_share;
|
|
|
|
// resource share according to AMS; overrides project
|
2006-05-23 06:46:19 +00:00
|
|
|
|
|
|
|
// stuff related to scheduler RPCs and master fetch
|
|
|
|
//
|
|
|
|
int rpc_seqno;
|
2002-07-15 05:34:32 +00:00
|
|
|
int nrpc_failures; // # of consecutive times we've failed to
|
|
|
|
// contact all scheduling servers
|
2003-02-28 23:14:18 +00:00
|
|
|
int master_fetch_failures;
|
2004-10-25 20:16:30 +00:00
|
|
|
double min_rpc_time; // earliest time to contact any server
|
2006-05-23 06:46:19 +00:00
|
|
|
// of this project (or zero)
|
|
|
|
void set_min_rpc_time(double future_time);
|
|
|
|
bool waiting_until_min_rpc_time();
|
|
|
|
// returns true if min_rpc_time > now
|
2002-07-15 05:34:32 +00:00
|
|
|
bool master_url_fetch_pending;
|
|
|
|
// need to fetch and parse the master URL
|
2006-08-24 20:33:46 +00:00
|
|
|
int sched_rpc_pending;
|
2006-05-23 06:46:19 +00:00
|
|
|
// we need to do a scheduler RPC, for various possible reasons:
|
2006-08-24 20:33:46 +00:00
|
|
|
// user request, propagate host CPID, time-based, etc.
|
|
|
|
// Reasons are enumerated in scheduler_op.h
|
2006-05-23 06:46:19 +00:00
|
|
|
double next_rpc_time;
|
|
|
|
// if nonzero, specifies a time when another scheduler RPC
|
|
|
|
// should be done (as requested by server)
|
2005-08-15 05:08:42 +00:00
|
|
|
bool trickle_up_pending; // have trickle up to send
|
2006-08-24 20:33:46 +00:00
|
|
|
bool tentative; // we haven't done a scheduler RPC to this project yet
|
|
|
|
// (still need to verify that its name isn't a dup)
|
2006-10-12 19:43:55 +00:00
|
|
|
double last_rpc_time; // when last RPC finished
|
|
|
|
|
|
|
|
// Other stuff
|
|
|
|
|
2004-07-06 18:31:56 +00:00
|
|
|
bool anonymous_platform; // app_versions.xml file found in project dir;
|
2005-06-18 21:54:24 +00:00
|
|
|
// use those apps rather then getting from server
|
2004-09-23 22:27:41 +00:00
|
|
|
bool non_cpu_intensive;
|
2006-06-20 17:36:28 +00:00
|
|
|
bool verify_files_on_app_start;
|
2004-09-23 22:27:41 +00:00
|
|
|
bool send_file_list;
|
|
|
|
// send the list of permanent files associated/with the project
|
|
|
|
// in the next scheduler reply
|
2004-09-26 04:16:52 +00:00
|
|
|
bool suspended_via_gui;
|
2005-06-11 08:09:16 +00:00
|
|
|
bool dont_request_more_work;
|
2006-05-23 06:46:19 +00:00
|
|
|
// Return work, but don't request more
|
|
|
|
// Used for a clean exit to a project,
|
|
|
|
// or if a user wants to pause doing work for the project
|
2005-12-09 22:29:21 +00:00
|
|
|
bool attached_via_acct_mgr;
|
2005-10-03 18:05:58 +00:00
|
|
|
char code_sign_key[MAX_KEY_LEN];
|
2004-06-30 18:17:21 +00:00
|
|
|
std::vector<FILE_REF> user_files;
|
2006-06-26 22:58:24 +00:00
|
|
|
std::vector<FILE_REF> project_files;
|
|
|
|
// files not specific to apps or work - e.g. icons
|
2003-11-02 22:51:49 +00:00
|
|
|
int parse_preferences_for_user_files();
|
2006-10-09 18:58:52 +00:00
|
|
|
int parse_project_files(MIOFILE&, bool delete_existing_symlinks);
|
2006-06-26 22:58:24 +00:00
|
|
|
void write_project_files(MIOFILE&);
|
2006-10-09 21:43:59 +00:00
|
|
|
void link_project_files(bool recreate_symlink_files);
|
2006-07-25 21:07:14 +00:00
|
|
|
int write_symlink_for_project_file(FILE_INFO*);
|
2006-10-12 19:43:55 +00:00
|
|
|
double project_files_downloaded_time;
|
|
|
|
// when last project file download finished
|
|
|
|
void update_project_files_downloaded_time();
|
|
|
|
// called when a project file download finishes.
|
|
|
|
// If it's the last one, set project_files_downloaded_time to now
|
2005-06-18 21:54:24 +00:00
|
|
|
|
|
|
|
// Multiply by this when estimating the CPU time of a result
|
|
|
|
// (based on FLOPs estimated and benchmarks).
|
|
|
|
// This is dynamically updated in a way that maintains an upper bound.
|
|
|
|
// it goes down slowly but if a new estimate X is larger,
|
|
|
|
// the factor is set to X.
|
|
|
|
//
|
|
|
|
double duration_correction_factor;
|
|
|
|
void update_duration_correction_factor(RESULT*);
|
2004-06-30 01:10:22 +00:00
|
|
|
|
2005-06-07 18:30:36 +00:00
|
|
|
// fields used by CPU scheduler and work fetch
|
|
|
|
// everything from here on applies only to CPU intensive projects
|
|
|
|
|
2005-06-07 19:22:50 +00:00
|
|
|
bool contactable();
|
|
|
|
// not suspended and not deferred and not no more work
|
2005-06-07 18:30:36 +00:00
|
|
|
bool runnable();
|
2005-06-07 21:21:35 +00:00
|
|
|
// has a runnable result
|
|
|
|
bool downloading();
|
|
|
|
// has a result in downloading state
|
2005-06-07 19:22:50 +00:00
|
|
|
bool potentially_runnable();
|
2005-06-07 21:21:35 +00:00
|
|
|
// runnable or contactable or downloading
|
2006-06-15 23:15:27 +00:00
|
|
|
bool nearly_runnable();
|
|
|
|
// runnable or downloading
|
|
|
|
bool overworked();
|
|
|
|
// the project has used too much CPU time recently
|
2005-06-07 18:30:36 +00:00
|
|
|
|
2006-08-23 21:14:47 +00:00
|
|
|
// temps used in CLIENT_STATE::rr_simulation();
|
2005-06-21 02:17:59 +00:00
|
|
|
std::vector<RESULT*>active;
|
|
|
|
std::vector<RESULT*>pending;
|
|
|
|
double rrsim_proc_rate;
|
2006-02-11 03:00:37 +00:00
|
|
|
// fraction of each CPU this project will get in RR simulation
|
2006-08-23 21:14:47 +00:00
|
|
|
void set_rrsim_proc_rate(double rrs);
|
2006-06-15 23:15:27 +00:00
|
|
|
// set in CLIENT_STATE::rr_misses_deadline();
|
|
|
|
double cpu_shortfall;
|
|
|
|
int rr_sim_deadlines_missed;
|
2006-06-19 22:20:24 +00:00
|
|
|
int deadlines_missed; // used as scratch by scheduler, enforcer
|
2005-06-21 02:17:59 +00:00
|
|
|
|
2005-06-07 18:30:36 +00:00
|
|
|
// "debt" is how much CPU time we owe this project relative to others
|
|
|
|
|
|
|
|
double short_term_debt;
|
|
|
|
// computed over runnable projects
|
|
|
|
// used for CPU scheduling
|
|
|
|
double long_term_debt;
|
|
|
|
// Computed over potentially runnable projects
|
|
|
|
// (defined for all projects, but doesn't change if
|
|
|
|
// not potentially runnable).
|
|
|
|
// Normalized so mean over all projects is zero
|
2004-08-21 23:11:19 +00:00
|
|
|
|
2005-06-01 05:49:51 +00:00
|
|
|
double anticipated_debt;
|
|
|
|
// expected debt by the end of the preemption period
|
2006-08-22 20:58:57 +00:00
|
|
|
double wall_cpu_time_this_debt_interval;
|
2005-06-09 21:37:34 +00:00
|
|
|
// how much "wall CPU time" has been devoted to this
|
2006-08-22 20:58:57 +00:00
|
|
|
// project in the current debt interval
|
2005-06-01 05:49:51 +00:00
|
|
|
struct RESULT *next_runnable_result;
|
|
|
|
// the next result to run for this project
|
2006-01-11 22:31:25 +00:00
|
|
|
int nactive_uploads;
|
|
|
|
// number of file uploads in progress.
|
|
|
|
// Don't start new results if these exceeds 2.
|
2005-05-09 04:49:56 +00:00
|
|
|
|
2005-02-06 21:26:21 +00:00
|
|
|
double work_request;
|
2006-04-21 00:02:04 +00:00
|
|
|
// the unit is "project-normalized CPU seconds",
|
2005-02-06 21:26:21 +00:00
|
|
|
// i.e. the work should take 1 CPU on this host
|
|
|
|
// X seconds of wall-clock time to complete,
|
|
|
|
// taking into account
|
2006-04-21 00:02:04 +00:00
|
|
|
// 1) this project's fractional resource share
|
2006-02-11 03:00:37 +00:00
|
|
|
// 2) on_frac, active_frac, and cpu_effiency
|
2006-04-21 00:02:04 +00:00
|
|
|
// see doc/sched.php
|
2005-05-06 19:09:41 +00:00
|
|
|
int work_request_urgency;
|
2005-06-01 05:49:51 +00:00
|
|
|
|
2005-05-31 23:43:34 +00:00
|
|
|
int nresults_returned;
|
|
|
|
// # of results being returned in current scheduler op
|
2005-06-01 05:49:51 +00:00
|
|
|
const char* get_scheduler_url(int index, double r);
|
|
|
|
// get scheduler URL with random offset r
|
2004-08-21 23:11:19 +00:00
|
|
|
bool checked;
|
2005-11-26 00:12:44 +00:00
|
|
|
// temporary used when scanning projects
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2005-09-30 21:29:31 +00:00
|
|
|
// vars related to file-transfer backoff
|
|
|
|
// file_xfer_failures_up: count of consecutive upload failures
|
|
|
|
// next_file_xfer_up: when to start trying uploads again
|
|
|
|
//
|
|
|
|
// if file_xfer_failures_up exceeds FILE_XFER_FAILURE_LIMIT,
|
|
|
|
// we switch from a per-file to a project-wide backoff policy
|
|
|
|
// (separately for the up/down directions)
|
|
|
|
//
|
|
|
|
#define FILE_XFER_FAILURE_LIMIT 3
|
|
|
|
private:
|
|
|
|
int file_xfer_failures_up;
|
|
|
|
int file_xfer_failures_down;
|
|
|
|
double next_file_xfer_up;
|
|
|
|
double next_file_xfer_down;
|
|
|
|
|
|
|
|
public:
|
|
|
|
double next_file_xfer_time(const bool);
|
|
|
|
void file_xfer_failed(const bool);
|
|
|
|
void file_xfer_succeeded(const bool);
|
|
|
|
|
2002-06-21 06:52:47 +00:00
|
|
|
PROJECT();
|
2005-08-15 05:08:42 +00:00
|
|
|
~PROJECT(){}
|
2003-06-23 22:05:14 +00:00
|
|
|
void init();
|
2002-06-21 06:52:47 +00:00
|
|
|
void copy_state_fields(PROJECT&);
|
2003-05-08 23:28:01 +00:00
|
|
|
char *get_project_name();
|
2003-05-13 18:55:07 +00:00
|
|
|
int write_account_file();
|
2002-09-26 05:57:10 +00:00
|
|
|
int parse_account(FILE*);
|
2006-07-14 21:08:12 +00:00
|
|
|
int parse_account_file_venue();
|
2003-11-02 22:51:49 +00:00
|
|
|
int parse_account_file();
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse_state(MIOFILE&);
|
2004-07-19 19:40:06 +00:00
|
|
|
int write_state(MIOFILE&, bool gui_rpc=false);
|
2005-06-11 08:09:16 +00:00
|
|
|
void attach_failed(int reason);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-12 23:07:04 +00:00
|
|
|
// statistic of the last x days
|
2005-08-11 04:45:16 +00:00
|
|
|
std::vector<DAILY_STATS> statistics;
|
2005-04-04 06:02:36 +00:00
|
|
|
int parse_statistics(MIOFILE&);
|
|
|
|
int parse_statistics(FILE*);
|
|
|
|
int write_statistics(MIOFILE&, bool gui_rpc=false);
|
|
|
|
int write_statistics_file();
|
2002-04-30 22:22:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct APP {
|
|
|
|
char name[256];
|
2006-06-26 19:08:00 +00:00
|
|
|
char user_friendly_name[256];
|
2002-04-30 22:22:54 +00:00
|
|
|
PROJECT* project;
|
|
|
|
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse(MIOFILE&);
|
|
|
|
int write(MIOFILE&);
|
2002-04-30 22:22:54 +00:00
|
|
|
};
|
|
|
|
|
2002-05-17 22:33:57 +00:00
|
|
|
struct APP_VERSION {
|
|
|
|
char app_name[256];
|
|
|
|
int version_num;
|
|
|
|
APP* app;
|
|
|
|
PROJECT* project;
|
2004-06-30 18:17:21 +00:00
|
|
|
std::vector<FILE_REF> app_files;
|
2003-03-02 19:24:09 +00:00
|
|
|
int ref_cnt;
|
2002-05-17 22:33:57 +00:00
|
|
|
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse(MIOFILE&);
|
|
|
|
int write(MIOFILE&);
|
2004-10-07 19:18:37 +00:00
|
|
|
bool had_download_failure(int& failnum);
|
2004-09-02 16:23:21 +00:00
|
|
|
void get_file_errors(std::string&);
|
|
|
|
void clear_errors();
|
2002-05-17 22:33:57 +00:00
|
|
|
};
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
struct WORKUNIT {
|
|
|
|
char name[256];
|
|
|
|
char app_name[256];
|
|
|
|
int version_num;
|
|
|
|
// This isn't sent from the server.
|
2002-07-29 00:39:45 +00:00
|
|
|
// Instead, the client picks the latest app version
|
2004-12-26 02:55:31 +00:00
|
|
|
std::string command_line;
|
|
|
|
//char env_vars[256]; // environment vars in URL format
|
2004-06-30 18:17:21 +00:00
|
|
|
std::vector<FILE_REF> input_files;
|
2002-04-30 22:22:54 +00:00
|
|
|
PROJECT* project;
|
|
|
|
APP* app;
|
|
|
|
APP_VERSION* avp;
|
|
|
|
int ref_cnt;
|
2003-09-04 00:41:51 +00:00
|
|
|
double rsc_fpops_est;
|
|
|
|
double rsc_fpops_bound;
|
|
|
|
double rsc_memory_bound;
|
|
|
|
double rsc_disk_bound;
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse(MIOFILE&);
|
|
|
|
int write(MIOFILE&);
|
2004-10-07 19:18:37 +00:00
|
|
|
bool had_download_failure(int& failnum);
|
2004-06-30 18:17:21 +00:00
|
|
|
void get_file_errors(std::string&);
|
2005-01-13 18:57:27 +00:00
|
|
|
void clear_errors();
|
2002-04-30 22:22:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct RESULT {
|
|
|
|
char name[256];
|
|
|
|
char wu_name[256];
|
2004-12-01 20:56:20 +00:00
|
|
|
double report_deadline;
|
2004-06-30 18:17:21 +00:00
|
|
|
std::vector<FILE_REF> output_files;
|
2003-09-23 23:19:41 +00:00
|
|
|
bool ready_to_report;
|
|
|
|
// we're ready to report this result to the server;
|
|
|
|
// either computation is done and all the files have been uploaded
|
|
|
|
// or there was an error
|
2005-05-20 17:57:10 +00:00
|
|
|
double completed_time;
|
|
|
|
// time when ready_to_report was set
|
2003-09-23 23:19:41 +00:00
|
|
|
bool got_server_ack;
|
|
|
|
// we're received the ack for this result from the server
|
2002-08-05 00:29:34 +00:00
|
|
|
double final_cpu_time;
|
2005-06-24 04:34:45 +00:00
|
|
|
double fpops_per_cpu_sec; // nonzero if reported by app
|
|
|
|
double fpops_cumulative; // nonzero if reported by app
|
2005-11-03 05:31:21 +00:00
|
|
|
double intops_per_cpu_sec; // nonzero if reported by app
|
|
|
|
double intops_cumulative; // nonzero if reported by app
|
2005-06-24 04:34:45 +00:00
|
|
|
int state; // state of this result: see lib/result_state.h
|
|
|
|
int exit_status; // return value from the application
|
2004-06-30 18:17:21 +00:00
|
|
|
std::string stderr_out;
|
2003-12-30 23:14:34 +00:00
|
|
|
// the concatenation of:
|
|
|
|
//
|
|
|
|
// - if report_result_error() is called for this result:
|
|
|
|
// <message>x</message>
|
|
|
|
// <exit_status>x</exit_status>
|
|
|
|
// <signal>x</signal>
|
|
|
|
// - if called in FILES_DOWNLOADED state:
|
|
|
|
// <couldnt_start>x</couldnt_start>
|
|
|
|
// - if called in NEW state:
|
|
|
|
// <download_error>x</download_error> for each failed download
|
|
|
|
// - if called in COMPUTE_DONE state:
|
|
|
|
// <upload_error>x</upload_error> for each failed upload
|
|
|
|
//
|
|
|
|
// - <stderr_txt>X</stderr_txt>, where X is the app's stderr output
|
2005-01-21 22:03:15 +00:00
|
|
|
bool suspended_via_gui;
|
2003-07-03 00:48:43 +00:00
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
APP* app;
|
|
|
|
WORKUNIT* wup;
|
2003-09-23 23:19:41 +00:00
|
|
|
// this may be NULL after result is finished
|
2002-04-30 22:22:54 +00:00
|
|
|
PROJECT* project;
|
|
|
|
|
2002-07-05 05:33:40 +00:00
|
|
|
void clear();
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse_server(MIOFILE&);
|
|
|
|
int parse_state(MIOFILE&);
|
2006-05-25 20:10:08 +00:00
|
|
|
int parse_name(FILE*, const char* end_tag);
|
2004-06-12 04:45:36 +00:00
|
|
|
int write(MIOFILE&, bool to_server);
|
2004-07-13 23:51:09 +00:00
|
|
|
int write_gui(MIOFILE&);
|
2002-04-30 22:22:54 +00:00
|
|
|
bool is_upload_done(); // files uploaded?
|
2006-06-19 17:40:53 +00:00
|
|
|
void clear_uploaded_flags();
|
2005-04-28 23:19:58 +00:00
|
|
|
FILE_REF* lookup_file(FILE_INFO*);
|
|
|
|
FILE_INFO* lookup_file_logical(const char*);
|
2006-05-25 20:10:08 +00:00
|
|
|
void abort_inactive(int);
|
|
|
|
// abort the result if it hasn't started computing yet
|
|
|
|
// Called only for results with no active task
|
|
|
|
// (otherwise you need to abort the active task)
|
2006-01-27 19:50:43 +00:00
|
|
|
|
|
|
|
// stuff related to CPU scheduling
|
|
|
|
|
2004-10-20 21:11:29 +00:00
|
|
|
double estimated_cpu_time();
|
2005-06-18 21:54:24 +00:00
|
|
|
double estimated_cpu_time_uncorrected();
|
2004-10-20 21:11:29 +00:00
|
|
|
double estimated_cpu_time_remaining();
|
2005-05-24 19:52:53 +00:00
|
|
|
bool computing_done();
|
2005-06-07 18:30:36 +00:00
|
|
|
bool runnable();
|
|
|
|
// downloaded, not finished, not suspended, project not suspended
|
2006-06-20 20:29:10 +00:00
|
|
|
bool nearly_runnable();
|
2005-06-07 21:46:11 +00:00
|
|
|
// downloading or downloaded,
|
|
|
|
// not finished, suspended, project not suspended
|
2006-09-06 21:58:12 +00:00
|
|
|
bool downloading();
|
|
|
|
// downloading, not downloaded, not suspended, project not suspended
|
2006-01-27 19:50:43 +00:00
|
|
|
// temporaries used in CLIENT_STATE::rr_misses_deadline():
|
|
|
|
double rrsim_cpu_left;
|
|
|
|
double rrsim_finish_delay;
|
|
|
|
bool already_selected;
|
|
|
|
// used to keep cpu scheduler from scheduling a result twice
|
|
|
|
// transient; used only within schedule_cpus()
|
2006-04-05 05:50:34 +00:00
|
|
|
double computation_deadline();
|
2006-06-15 23:15:27 +00:00
|
|
|
// used by the CPU scheduler to determine if there is a cause for
|
|
|
|
// a pre-emption of running results.
|
|
|
|
bool rr_sim_misses_deadline;
|
|
|
|
bool last_rr_sim_missed_deadline;
|
2006-01-28 00:17:26 +00:00
|
|
|
};
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
#endif
|