- client: when looking for new file xfers to start,

favor those that are partially done
- client: fix crashing bug if a project is detached
    while an RSS feed fetch for it is in progress
- code cleanup: switch from /// back to // for comments
    (so much for doxygen)

svn path=/trunk/boinc/; revision=21041
This commit is contained in:
David Anderson 2010-04-01 05:54:29 +00:00
parent 12869ae674
commit b0cb81159f
19 changed files with 439 additions and 434 deletions

View File

@ -2322,3 +2322,18 @@ David 31 Mar 2010
client/
work_fetch.cpp
David 31 Mar 2010
- client: when looking for new file xfers to start,
favor those that are partially done
- client: fix crashing bug if a project is detached
while an RSS feed fetch for it is in progress
- code cleanup: switch from /// back to // for comments
(so much for doxygen)
client/
pers_file_xfer.cpp
file_xfer.cpp
client_types.cpp
cs_notices.cpp
*.h

View File

@ -26,7 +26,7 @@
#include "gui_http.h"
#include "client_types.h"
/// represents info stored in acct_mgr_url.xml and acct_mgr_login.xml
// represents info stored in acct_mgr_url.xml and acct_mgr_login.xml
struct ACCT_MGR_INFO {
// the following used to be std::string but there
@ -35,27 +35,27 @@ struct ACCT_MGR_INFO {
char acct_mgr_name[256];
char acct_mgr_url[256];
char login_name[256];
/// md5 of password.lowercase(login_name)
char password_hash[256];
/// whatever the AMS sends us
// md5 of password.lowercase(login_name)
char opaque[256];
// whatever the AMS sends us
char signing_key[MAX_KEY_LEN];
/// the host CPID sent in last RPC
char previous_host_cpid[64];
// the host CPID sent in last RPC
double next_rpc_time;
/// whether to include GUI RPC port and password hash
/// in AM RPCs (used for "farm management")
bool send_gui_rpc_info;
/// use of cookies are required during initial signup
/// NOTE: This bool gets dropped after the client has
/// successfully attached to an account manager
// whether to include GUI RPC port and password hash
// in AM RPCs (used for "farm management")
bool cookie_required;
/// if the cookies could not be detected, provide a
/// link to a website to go to so the user can find
/// what login name and password they have been assigned
/// NOTE: This bool gets dropped after the client has
/// successfully attached to an account manager
// use of cookies are required during initial signup
// NOTE: This bool gets dropped after the client has
// successfully attached to an account manager
char cookie_failure_url[256];
// if the cookies could not be detected, provide a
// link to a website to go to so the user can find
// what login name and password they have been assigned
// NOTE: This bool gets dropped after the client has
// successfully attached to an account manager
bool password_error;
ACCT_MGR_INFO();

View File

@ -21,7 +21,7 @@
#include "gui_http.h"
#include "error_numbers.h"
/// represents the contents of project_info.xml
// represents the contents of project_info.xml
struct PROJECT_INIT {
char url[256];
@ -37,10 +37,10 @@ struct PROJECT_INIT {
struct ACCOUNT_IN {
std::string url;
/// the account identifier (user name or email addr)
std::string email_addr;
/// the suggested friendly name for the user during account creation.
// the account identifier (user name or email addr)
std::string user_name;
// the suggested friendly name for the user during account creation.
std::string team_name;
std::string passwd_hash;

View File

@ -43,13 +43,13 @@ typedef int PROCESS_ID;
// before sending to server,
// to protect against apps that write unbounded amounts.
/// Represents a job in progress.
// Represents a job in progress.
/// When an active task is created, it is assigned a "slot"
/// which determines the directory it runs in.
/// This doesn't change over the life of the active task;
/// thus the task can use the slot directory for temp files
/// that BOINC doesn't know about.
// When an active task is created, it is assigned a "slot"
// which determines the directory it runs in.
// This doesn't change over the life of the active task;
// thus the task can use the slot directory for temp files
// that BOINC doesn't know about.
struct ACTIVE_TASK {
#ifdef _WIN32
@ -63,73 +63,70 @@ struct ACTIVE_TASK {
PROCESS_ID pid;
PROCINFO procinfo;
//// START OF ITEMS SAVED IN STATE FILE
// START OF ITEMS SAVED IN STATE FILE
int _task_state;
/// subdirectory of slots/ where this runs
int slot;
/// CPU at the last checkpoint
/// Note: "CPU time" refers to the sum over all episodes.
/// (not counting the "lost" time after the last checkpoint
/// in episodes before the current one)
/// TODO: debt should be based on FLOPs, not CPU time
/// CPU time at the start of current episode
// subdirectory of slots/ where this runs
double checkpoint_cpu_time;
/// elapsed time at last checkpoint
// CPU at the last checkpoint
// Note: "CPU time" refers to the sum over all episodes.
// (not counting the "lost" time after the last checkpoint
// in episodes before the current one)
// TODO: debt should be based on FLOPs, not CPU time
// CPU time at the start of current episode
double checkpoint_elapsed_time;
/// App's estimate of how much of the work unit is done.
/// Passed from the application via an API call;
/// will be zero if the app doesn't use this call
// elapsed time at last checkpoint
double fraction_done;
/// most recent CPU time reported by app
// App's estimate of how much of the work unit is done.
// Passed from the application via an API call;
// will be zero if the app doesn't use this call
double current_cpu_time;
// most recent CPU time reported by app
bool once_ran_edf;
//// END OF ITEMS SAVED IN STATE FILE
// END OF ITEMS SAVED IN STATE FILE
int scheduler_state;
int next_scheduler_state; // temp
int signal;
/// Wall time at the start of the current run interval
double run_interval_start_wall_time;
/// wall time at the last checkpoint
// Wall time at the start of the current run interval
double checkpoint_wall_time;
/// current total elapsed (running) time
// wall time at the last checkpoint
double elapsed_time;
/// disk used by output files and temp files of this task
// current total elapsed (running) time
int current_disk_usage(double&);
/// directory where process runs (relative)
// disk used by output files and temp files of this task
char slot_dir[256];
/// same, absolute
/// This is used only to run graphics apps
/// (that way don't have to worry about top-level dirs
/// being non-readable, etc).
// directory where process runs (relative)
char slot_path[512];
/// abort if elapsed time exceeds this
// same, absolute
// This is used only to run graphics apps
// (that way don't have to worry about top-level dirs
// being non-readable, etc).
double max_elapsed_time;
/// abort if disk usage (in+out+temp) exceeds this
// abort if elapsed time exceeds this
double max_disk_usage;
/// abort if memory usage exceeds this
// abort if disk usage (in+out+temp) exceeds this
double max_mem_usage;
// abort if memory usage exceeds this
bool have_trickle_down;
bool send_upload_file_status;
/// working set too large to run now
bool too_large;
// working set too large to run now
bool needs_shmem; // waiting for a free shared memory segment
int want_network;
/// This task wants to do network comm (for F@h)
/// this is passed via share-memory message (app_status channel)
// This task wants to do network comm (for F@h)
// this is passed via share-memory message (app_status channel)
double abort_time;
/// when we sent an abort message to this app
/// kill it 5 seconds later if it doesn't exit
// when we sent an abort message to this app
// kill it 5 seconds later if it doesn't exit
double quit_time;
/// when we sent a quit message; kill if still there after 10 sec
int premature_exit_count;
// when we sent a quit message; kill if still there after 10 sec
/// core/app shared mem segment
APP_CLIENT_SHM app_client_shm;
// core/app shared mem segment
MSG_QUEUE graphics_request_queue;
MSG_QUEUE process_control_queue;
@ -140,10 +137,10 @@ struct ACTIVE_TASK {
// info related to app's graphics mode (win, screensaver, etc.)
//
/// mode acked by app
int graphics_mode_acked;
/// mode before last screensaver request
// mode acked by app
int graphics_mode_before_ss;
// mode before last screensaver request
double graphics_mode_ack_timeout;
#ifdef SIM
@ -180,24 +177,24 @@ struct ACTIVE_TASK {
// i.e. by sending a <quit> message
int request_abort(); // send "abort" message
bool process_exists();
/// Kill process forcibly,
/// Unix: send a SIGKILL signal, Windows: TerminateProcess()
/// if restart is true, arrange for resulted to get restarted;
/// otherwise it ends with an error
int kill_task(bool restart);
/// tell a process to stop executing (but stay in mem)
// Kill process forcibly,
// otherwise it ends with an error
// Unix: send a SIGKILL signal, Windows: TerminateProcess()
// if restart is true, arrange for resulted to get restarted;
/// Done by sending it a <suspend> message
int suspend();
/// Undo a suspend: send a <resume> message
// tell a process to stop executing (but stay in mem)
// Done by sending it a <suspend> message
int unsuspend();
/// can be called whether or not process exists
// Undo a suspend: send a <resume> message
int abort_task(int exit_status, const char*);
/// return true if this task has exited
// can be called whether or not process exists
bool has_task_exited();
/// preempt (via suspend or quit) a running task
// return true if this task has exited
int preempt(int preempt_type);
// preempt (via suspend or quit) a running task
int resume_or_start(bool);
void send_network_available();
#ifdef _WIN32
@ -229,7 +226,7 @@ struct ACTIVE_TASK {
int parse(MIOFILE&);
};
/// Represents the set of all jobs in progress
// Represents the set of all jobs in progress
class ACTIVE_TASK_SET {
public:

View File

@ -30,7 +30,7 @@
#include "log_flags.h"
/// stores a message in memory, where it can be retrieved via RPC
// stores a message in memory, where it can be retrieved via RPC
struct MESSAGE_DESC {
char project_name[256];
@ -61,7 +61,7 @@ extern MESSAGE_DESCS message_descs;
#define __attribute__(x) /*nothing*/
#endif
/// Show a message, preceded by timestamp and project name
// Show a message, preceded by timestamp and project name
extern void msg_printf(struct PROJECT *p, int priority, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));

View File

@ -105,38 +105,38 @@ public:
bool requested_suspend;
bool requested_resume;
bool cleanup_completed;
/// Determine when it is safe to leave the quit_client() handler
/// and to finish cleaning up.
bool in_abort_sequence;
/// stores URL for -detach_project option
// Determine when it is safe to leave the quit_client() handler
// and to finish cleaning up.
char detach_project_url[256];
/// stores URL for -reset_project option
// stores URL for -detach_project option
char reset_project_url[256];
/// stores URL for -update_prefs option
// stores URL for -reset_project option
char update_prefs_url[256];
/// venue from project or AMS that gave us general prefs
// stores URL for -update_prefs option
char main_host_venue[256];
// venue from project or AMS that gave us general prefs
char attach_project_url[256];
char attach_project_auth[256];
/// exit when about to upload a file
bool exit_before_upload;
// exit when about to upload a file
#ifndef _WIN32
gid_t boinc_project_gid;
#endif
// backoff-related variables
//
/// fetch project's master URL (and stop doing scheduler RPCs)
/// if get this many successive RPC failures (default 10)
int master_fetch_period;
/// cap project->nrpc_failures at this number
// fetch project's master URL (and stop doing scheduler RPCs)
// if get this many successive RPC failures (default 10)
int retry_cap;
/// after this many master-fetch failures,
/// move into a state in which we retry master fetch
/// at the frequency below
// cap project->nrpc_failures at this number
int master_fetch_retry_cap;
/// see above
// after this many master-fetch failures,
// move into a state in which we retry master fetch
// at the frequency below
int master_fetch_interval;
// see above
int sched_retry_delay_min;
int sched_retry_delay_max;
@ -144,54 +144,54 @@ public:
int pers_retry_delay_max;
int pers_giveup;
/// Don't use CPU. See check_suspend_activities for logic
bool tasks_suspended;
/// Don't use network. See check_suspend_network for logic
// Don't use CPU. See check_suspend_activities for logic
bool network_suspended;
// Don't use network. See check_suspend_network for logic
int suspend_reason;
int network_suspend_reason;
/// true if --daemon is on the commandline
/// this means we are running as a daemon on unix,
/// or as a service on Windows
bool executing_as_daemon;
/// redirect stdout, stderr to log files
// true if --daemon is on the commandline
// this means we are running as a daemon on unix,
// or as a service on Windows
bool redirect_io;
/// a condition has occurred in which we know graphics will
/// not be displayable, so GUIs shouldn't offer graphics.
// redirect stdout, stderr to log files
bool disable_graphics;
// a condition has occurred in which we know graphics will
// not be displayable, so GUIs shouldn't offer graphics.
bool detach_console;
/// this affects auto-update
bool launched_by_manager;
// this affects auto-update
bool run_by_updater;
double now;
double client_start_time;
double last_wakeup_time;
bool initialized;
/// failed to write state file.
/// In this case we continue to run for 1 minute,
/// handling GUI RPCs but doing nothing else,
/// so that the Manager can tell the user what the problem is
bool cant_write_state_file;
/// accept unsigned app files (use for testing only!!)
// failed to write state file.
// In this case we continue to run for 1 minute,
// handling GUI RPCs but doing nothing else,
// so that the Manager can tell the user what the problem is
bool unsigned_apps_ok;
/// use hardwired numbers rather than running benchmarks
// accept unsigned app files (use for testing only!!)
bool skip_cpu_benchmarks;
// use hardwired numbers rather than running benchmarks
private:
bool client_state_dirty;
int old_major_version;
int old_minor_version;
int old_release;
/// if set, run benchmarks on client startup
bool run_cpu_benchmarks;
/// set if a benchmark fails to start because of a job that doesn't exit
/// Persists so that the next start of BOINC runs the benchmarks.
// if set, run benchmarks on client startup
bool cpu_benchmarks_pending;
// set if a benchmark fails to start because of a job that doesn't exit
// Persists so that the next start of BOINC runs the benchmarks.
/// if nonzero, exit this many seconds after starting an app
int exit_after_app_start_secs;
/// when the most recent app was started
// if nonzero, exit this many seconds after starting an app
double app_started;
// when the most recent app was started
// --------------- acct_mgr.cpp:
public:
@ -220,10 +220,10 @@ public:
CLIENT_STATE();
void show_host_info();
int init();
/// Never blocks.
/// Returns true if it actually did something,
/// in which case it should be called again immediately.
bool poll_slow_events();
// Never blocks.
// Returns true if it actually did something,
// in which case it should be called again immediately.
void do_io_or_sleep(double dt);
bool time_to_exit();
PROJECT* lookup_project(const char*);
@ -279,13 +279,12 @@ private:
void append_unfinished_time_slice(vector<RESULT*>&);
public:
double runnable_resource_share(int);
/// Check if work fetch needed.
void adjust_debts();
std::vector <RESULT*> ordered_scheduled_results;
/// if we fail to start a task due to no shared-mem segments,
/// wait until at least this time to try running
/// another task that needs a shared-mem seg
double retry_shmem_time;
// if we fail to start a task due to no shared-mem segments,
// wait until at least this time to try running
// another task that needs a shared-mem seg
inline double work_buf_min() {
return global_prefs.work_buf_min_days * 86400;
}
@ -298,17 +297,17 @@ public:
return x;
}
void request_enforce_schedule(PROJECT*, const char*);
/// Check for reschedule CPUs ASAP.
/// Called when:
/// - core client starts (CS::init())
/// - an app exits (ATS::check_app_exited())
/// - Tasks are killed (ATS::exit_tasks())
/// - a result's input files finish downloading (CS::update_results())
/// - an app fails to start (CS::schedule_cpus())
/// - any project op is done via RPC (suspend/resume)
/// - any result op is done via RPC (suspend/resume)
void request_schedule_cpus(const char*);
// Check for reschedule CPUs ASAP.
// Called when:
// - core client starts (CS::init())
// - an app exits (ATS::check_app_exited())
// - Tasks are killed (ATS::exit_tasks())
// - a result's input files finish downloading (CS::update_results())
// - an app fails to start (CS::schedule_cpus())
// - any project op is done via RPC (suspend/resume)
// - any result op is done via RPC (suspend/resume)
void set_ncpus();
// --------------- cs_account.cpp:
@ -329,8 +328,8 @@ public:
double get_fraction_done(RESULT* result);
int input_files_available(RESULT*, bool, FILE_INFO** f=0);
ACTIVE_TASK* lookup_active_task_by_result(RESULT*);
/// number of usable cpus
int ncpus;
// number of usable cpus
private:
int latest_version(APP*, char*);
int app_finished(ACTIVE_TASK&);
@ -376,8 +375,8 @@ private:
// --------------- cs_prefs.cpp:
public:
int project_disk_usage(PROJECT*, double&);
/// returns the total disk usage of BOINC on this host
int total_disk_usage(double&);
// returns the total disk usage of BOINC on this host
double allowed_disk_usage(double boinc_total);
int allowed_project_disk_usage(double&);
int suspend_tasks(int reason);
@ -397,14 +396,14 @@ private:
// --------------- cs_scheduler.cpp:
public:
/// Called when:
/// - core client starts (CS::init())
/// - task is completed or fails
/// - tasks are killed
/// - an RPC completes
/// - project suspend/detch/attach/reset GUI RPC
/// - result suspend/abort GUI RPC
void request_work_fetch(const char*);
// Called when:
// - core client starts (CS::init())
// - task is completed or fails
// - tasks are killed
// - an RPC completes
// - project suspend/detch/attach/reset GUI RPC
// - result suspend/abort GUI RPC
int make_scheduler_request(PROJECT*);
int handle_scheduler_reply(PROJECT*, char* scheduler_url);
SCHEDULER_OP* scheduler_op;
@ -490,7 +489,7 @@ extern COPROC_CUDA* coproc_cuda;
extern COPROC_ATI* coproc_ati;
extern bool gpus_usable;
/// return a random double in the range [MIN,min(e^n,MAX))
// return a random double in the range [MIN,min(e^n,MAX))
extern double calculate_exponential_backoff(
int n, double MIN, double MAX

View File

@ -984,19 +984,8 @@ const char* FILE_INFO::get_init_url() {
// if a project supplies multiple URLs, try them in order
// (e.g. in Einstein@home they're ordered by proximity to client).
// The commented-out code tries them starting from random place.
// This is appropriate if replication is for load-balancing.
// TODO: add a flag saying which mode to use.
//
#if 1
current_url = 0;
#else
double temp;
temp = rand();
temp *= urls.size();
temp /= RAND_MAX;
current_url = (int)temp;
#endif
start_url = current_url;
return urls[current_url].c_str();
}

View File

@ -68,36 +68,36 @@ struct FILE_INFO {
bool upload_when_present;
bool sticky; // don't delete unless instructed to do so
bool report_on_rpc; // include this in each scheduler request
/// if not in use, delete even if sticky is true
/// don't report to server even if report_on_rpc is true
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
bool signature_required; // true iff associated with app version
bool is_user_file;
bool is_project_file;
bool is_auto_update_file;
/// for output files: gzip file when done, and append .gz to its name
bool gzip_when_done;
/// nonzero if in the process of being up/downloaded
// for output files: gzip file when done, and append .gz to its name
class PERS_FILE_XFER* pers_file_xfer;
/// for upload files (to authenticate)
// nonzero if in the process of being up/downloaded
RESULT* result;
// for upload files (to authenticate)
PROJECT* project;
int ref_cnt;
std::vector<std::string> urls;
int start_url;
int current_url;
/// if the file_info is signed (for uploadable files)
/// this is the text that is signed
/// Otherwise it is the FILE_INFO's XML descriptor
/// (without enclosing <file_info> tags)
char signed_xml[MAX_FILE_INFO_LEN];
/// ... and this is the signature
// if the file_info is signed (for uploadable files)
// this is the text that is signed
// Otherwise it is the FILE_INFO's XML descriptor
// (without enclosing <file_info> tags)
char xml_signature[MAX_SIGNATURE_LEN];
/// if the file itself is signed (for executable files)
/// this is the signature
// ... and this is the signature
char file_signature[MAX_SIGNATURE_LEN];
/// if permanent error occurs during file xfer, it's recorded here
// if the file itself is signed (for executable files)
// this is the signature
std::string error_msg;
// if permanent error occurs during file xfer, it's recorded here
CERT_SIGS* cert_sigs;
FILE_INFO();
@ -107,8 +107,8 @@ struct FILE_INFO {
int parse(MIOFILE&, bool from_server);
int write(MIOFILE&, bool to_server);
int write_gui(MIOFILE&);
/// attempt to delete the underlying file
int delete_file();
// attempt to delete the underlying file
const char* get_init_url();
const char* get_next_url();
const char* get_current_url();
@ -117,29 +117,29 @@ struct FILE_INFO {
int merge_info(FILE_INFO&);
int verify_file(bool, bool);
bool verify_file_certs();
/// gzip file and add .gz to name
int gzip();
// gzip file and add .gz to name
};
/// Describes a connection between a file and a workunit, result, or application
// 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)
// 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 {
/// physical name
char file_name[256];
/// logical name
// physical name
char open_name[256];
// logical name
bool main_program;
FILE_INFO* file_info;
/// if true, core client will copy the file instead of linking
bool copy_file;
/// for output files: app may not generate file;
/// don't treat as error if file is missing.
// if true, core client will copy the file instead of linking
bool optional;
// for output files: app may not generate file;
// don't treat as error if file is missing.
int parse(MIOFILE&);
int write(MIOFILE&);
};
@ -166,7 +166,7 @@ struct FILE_XFER_BACKOFF {
}
};
/// statistics at a specific day
// statistics at a specific day
struct DAILY_STATS {
double user_total_credit;
@ -185,22 +185,23 @@ struct PROJECT {
// the following items come from the account file
// They are a function only of the user and the project
//
/// url of site that contains scheduler tags for this project
char master_url[256];
/// user's authenticator on this project
// url of site that contains scheduler tags for this project
char authenticator[256];
/// 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
// user's authenticator on this project
std::string project_prefs;
/// without enclosing <project_specific> tags
/// Does not include <venue> elements
// 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
std::string project_specific_prefs;
/// GUI URLs, with enclosing <gui_urls> tags
// without enclosing <project_specific> tags
// Does not include <venue> elements
std::string gui_urls;
/// project's resource share relative to other projects.
// GUI URLs, with enclosing <gui_urls> tags
double resource_share;
// project's resource share relative to other projects.
// the following are the user's project prefs
bool no_cpu_pref;
bool no_cuda_pref;
@ -217,22 +218,22 @@ struct PROJECT {
bool ati_low_mem;
// same, ATI
/// 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.
char host_venue[256];
// 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.
bool using_venue_specific_prefs;
// the following items come from client_state.xml
// They may depend on the host as well as user and project
// NOTE: if you add anything, add it to copy_state_fields() also!!!
//
/// where to find scheduling servers
std::vector<std::string> scheduler_urls;
/// descriptive. not unique
// where to find scheduling servers
char project_name[256];
/// URL of symbol server (Windows)
// descriptive. not unique
char symstore[256];
// URL of symbol server (Windows)
char user_name[256];
char team_name[256];
char email_hash[MD5_LEN];
@ -252,39 +253,39 @@ struct PROJECT {
// stuff related to scheduler RPCs and master fetch
//
int rpc_seqno;
/// # of consecutive times we've failed to contact all scheduling servers
int nrpc_failures;
// # of consecutive times we've failed to contact all scheduling servers
int master_fetch_failures;
/// earliest time to contact any server of this project (or zero)
double min_rpc_time;
// earliest time to contact any server of this project (or zero)
void set_min_rpc_time(double future_time, const char* reason);
/// if nonzero, specifies a time when another scheduler RPC
/// should be done (as requested by server).
/// An RPC could be done sooner than this.
double next_rpc_time;
/// returns true if min_rpc_time > now
// if nonzero, specifies a time when another scheduler RPC
// should be done (as requested by server).
// An RPC could be done sooner than this.
bool waiting_until_min_rpc_time();
/// need to fetch and parse the master URL
// returns true if min_rpc_time > now
bool master_url_fetch_pending;
/// we need to do a scheduler RPC, for various possible reasons:
/// user request, propagate host CPID, time-based, etc.
/// Reasons are enumerated in scheduler_op.h
// need to fetch and parse the master URL
int sched_rpc_pending;
/// we need to call request_work_fetch() when a project
/// transitions from being backed off to not.
/// This (slightly misnamed) keeps track of whether this
/// may still need to be done for given project
// we need to do a scheduler RPC, for various possible reasons:
// user request, propagate host CPID, time-based, etc.
// Reasons are enumerated in scheduler_op.h
bool possibly_backed_off;
/// have trickle up to send
// we need to call request_work_fetch() when a project
// transitions from being backed off to not.
// This (slightly misnamed) keeps track of whether this
// may still need to be done for given project
bool trickle_up_pending;
/// when last RPC finished
// have trickle up to send
double last_rpc_time;
// when last RPC finished
// Other stuff
/// app_versions.xml file found in project dir;
/// use those apps rather then getting from server
bool anonymous_platform;
// app_versions.xml file found in project dir;
// use those apps rather then getting from server
bool non_cpu_intensive;
bool verify_files_on_app_start;
bool use_symlinks;
@ -292,74 +293,74 @@ struct PROJECT {
// items send in scheduler replies, requesting that
// various things be sent in the next request
//
/// send the list of permanent files associated with the project
/// in the next scheduler reply
bool send_file_list;
/// if nonzero, send time stats log from that point on
// send the list of permanent files associated with the project
// in the next scheduler reply
int send_time_stats_log;
/// if nonzero, send this project's job log from that point on
// if nonzero, send time stats log from that point on
int send_job_log;
// if nonzero, send this project's job log from that point on
bool suspended_via_gui;
/// 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
bool dont_request_more_work;
// 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
bool attached_via_acct_mgr;
/// when no results for this project, detach it.
bool detach_when_done;
/// project has ended; advise user to detach
// when no results for this project, detach it.
bool ended;
// project has ended; advise user to detach
char code_sign_key[MAX_KEY_LEN];
std::vector<FILE_REF> user_files;
/// files not specific to apps or work - e.g. icons
std::vector<FILE_REF> project_files;
// files not specific to apps or work - e.g. icons
int parse_preferences_for_user_files();
int parse_project_files(MIOFILE&, bool delete_existing_symlinks);
void write_project_files(MIOFILE&);
void link_project_files(bool recreate_symlink_files);
int write_symlink_for_project_file(FILE_INFO*);
/// when last project file download finished
double project_files_downloaded_time;
/// called when a project file download finishes.
/// If it's the last one, set project_files_downloaded_time to now
// 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
/// 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;
// 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.
void update_duration_correction_factor(ACTIVE_TASK*);
// fields used by CPU scheduler and work fetch
// everything from here on applies only to CPU intensive projects
/// not suspended and not deferred and not no more work
bool can_request_work();
/// has a runnable result using the given resource type
// not suspended and not deferred and not no more work
bool runnable(int rsc_type);
/// has a result in downloading state
// has a runnable result using the given resource type
bool downloading();
/// runnable or contactable or downloading
// has a result in downloading state
bool potentially_runnable();
/// runnable or downloading
// runnable or contactable or downloading
bool nearly_runnable();
/// the project has used too much CPU time recently
// runnable or downloading
bool overworked();
/// a download is backed off
// the project has used too much CPU time recently
bool some_download_stalled();
// a download is backed off
bool some_result_suspended();
RR_SIM_PROJECT_STATUS rr_sim_status;
// temps used in CLIENT_STATE::rr_simulation();
/// the next result to run for this project
struct RESULT *next_runnable_result;
/// number of results in UPLOADING state
/// Don't start new results if these exceeds 2*ncpus.
// the next result to run for this project
int nuploading_results;
// number of results in UPLOADING state
// Don't start new results if these exceeds 2*ncpus.
bool too_many_uploading_results;
// stuff related to work fetch
@ -381,12 +382,12 @@ struct PROJECT {
return cpu_pwf.deadlines_missed;
}
/// # of results being returned in current scheduler op
int nresults_returned;
/// get scheduler URL with random offset r
// # of results being returned in current scheduler op
const char* get_scheduler_url(int index, double r);
/// temporary used when scanning projects
// get scheduler URL with random offset r
bool checked;
// temporary used when scanning projects
FILE_XFER_BACKOFF download_backoff;
FILE_XFER_BACKOFF upload_backoff;
@ -438,8 +439,8 @@ struct APP_VERSION {
double natis;
double gpu_ram;
double flops;
/// additional cmdline args
char cmdline[256];
// additional cmdline args
APP* app;
PROJECT* project;
@ -477,9 +478,9 @@ struct APP_VERSION {
struct WORKUNIT {
char name[256];
char app_name[256];
/// Deprecated, but need to keep around to let people revert
/// to versions before multi-platform support
int version_num;
// Deprecated, but need to keep around to let people revert
// to versions before multi-platform support
std::string command_line;
std::vector<FILE_REF> input_files;
PROJECT* project;
@ -509,14 +510,14 @@ struct RESULT {
char platform[256];
APP_VERSION* avp;
std::vector<FILE_REF> output_files;
/// 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
bool ready_to_report;
/// time when ready_to_report was set
// 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
double completed_time;
/// we've received the ack for this result from the server
// time when ready_to_report was set
bool got_server_ack;
// we've received the ack for this result from the server
double final_cpu_time;
double final_elapsed_time;
@ -526,35 +527,35 @@ struct RESULT {
double intops_per_cpu_sec;
double intops_cumulative;
/// state of this result: see lib/result_state.h
int _state;
// state of this result: see lib/result_state.h
inline int state() { return _state; }
void set_state(int, const char*);
/// return value from the application
int exit_status;
/// 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
// return value from the application
std::string stderr_out;
// 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
bool suspended_via_gui;
bool coproc_missing;
// a coproc needed by this job is missing
// (e.g. because user removed their GPU board).
APP* app;
/// this may be NULL after result is finished
WORKUNIT* wup;
// this may be NULL after result is finished
PROJECT* project;
RESULT(){}
@ -569,11 +570,10 @@ struct RESULT {
void clear_uploaded_flags();
FILE_REF* lookup_file(FILE_INFO*);
FILE_INFO* lookup_file_logical(const char*);
/// 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)
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)
void append_log_record();
// stuff related to CPU scheduling
@ -591,16 +591,16 @@ struct RESULT {
return false;
}
bool not_started();
/// downloaded, not finished, not suspended, project not suspended
bool runnable();
/// downloading or downloaded,
/// not finished, suspended, project not suspended
// downloaded, not finished, not suspended, project not suspended
bool nearly_runnable();
/// downloading, not downloaded, not suspended, project not suspended
// downloading or downloaded,
// not finished, suspended, project not suspended
bool downloading();
/// some input or app file is downloading, and backed off
/// i.e. it may be a long time before we can run this result
// downloading, not downloaded, not suspended, project not suspended
bool some_download_stalled();
// some input or app file is downloading, and backed off
// i.e. it may be a long time before we can run this result
inline bool uses_cuda() {
return (avp->ncudas > 0);
}
@ -618,19 +618,19 @@ struct RESULT {
double rrsim_finish_delay;
double rrsim_flops;
/// used to keep cpu scheduler from scheduling a result twice
/// transient; used only within schedule_cpus()
bool already_selected;
/// report deadline - prefs.work_buf_min - time slice
// used to keep cpu scheduler from scheduling a result twice
// transient; used only within schedule_cpus()
double computation_deadline();
// report deadline - prefs.work_buf_min - time slice
bool rr_sim_misses_deadline;
// temporaries used in enforce_schedule():
bool unfinished_time_slice;
int seqno;
/// temporary used to tell GUI that this result is deadline-scheduled
bool edf_scheduled;
// temporary used to tell GUI that this result is deadline-scheduled
int coproc_indices[MAX_COPROCS_PER_JOB];
// keep track of coprocessor reservations
@ -642,7 +642,7 @@ struct RESULT {
// (wait for free video RAM)
};
/// represents an always/auto/never value, possibly temporarily overridden
// represents an always/auto/never value, possibly temporarily overridden
class MODE {
private:
@ -657,7 +657,7 @@ public:
double delay();
};
/// a platform supported by the client.
// a platform supported by the client.
class PLATFORM {
public:

View File

@ -583,6 +583,8 @@ void RSS_FEED_OP::handle_reply(int http_op_retval) {
char filename[256];
int nitems;
if (!rfp) return; // op was canceled
if (http_op_retval) {
if (log_flags.notice_debug) {
msg_printf(0, MSG_INFO,
@ -700,7 +702,11 @@ void RSS_FEEDS::update_feed_list() {
if (rf.found) {
iter++;
} else {
// TODO: check if fetch in progress!
// cancel op if active
//
if (rss_feed_op.rfp == &(*iter)) {
rss_feed_op.rfp = NULL;
}
if (log_flags.notice_debug) {
msg_printf(0, MSG_INFO,
"[notice_debug] removing feed: %s",

View File

@ -76,7 +76,6 @@ int FILE_XFER::init_download(FILE_INFO& file_info) {
int FILE_XFER::init_upload(FILE_INFO& file_info) {
// If upload_offset < 0, we need to query the upload handler
// for the offset information
// TODO: give priority to unfinished upload if there are multiple choices
//
fip = &file_info;
get_pathname(fip, pathname, sizeof(pathname));

View File

@ -37,13 +37,13 @@ public:
char header[4096];
bool file_size_query;
bool is_upload;
/// File size at start of transfer, used for:
/// 1) a "minimum download increment"
/// that rejects partial downloads of less than 5K,
/// since these may be error messages from proxies.
/// 2) lets us recover when server ignored Range request
/// and sent us whole file
double starting_size;
// File size at start of transfer, used for:
// 1) a "minimum download increment"
// that rejects partial downloads of less than 5K,
// since these may be error messages from proxies.
// 2) lets us recover when server ignored Range request
// and sent us whole file
FILE_XFER();
~FILE_XFER();
@ -58,8 +58,8 @@ public:
class FILE_XFER_SET {
HTTP_OP_SET* http_ops;
public:
/// has there been transfer activity since last call to check_active()?
bool up_active, down_active;
// has there been transfer activity since last call to check_active()?
std::vector<FILE_XFER*> file_xfers;
FILE_XFER_SET(HTTP_OP_SET*);
int insert(FILE_XFER*);

View File

@ -41,17 +41,17 @@ public:
char request_msg[GUI_RPC_REQ_MSG_SIZE+1];
int request_nbytes;
char nonce[256];
/// if true, don't allow operations other than authentication
bool auth_needed;
// if true, don't allow operations other than authentication
bool got_auth1;
/// keep track of whether we've got the 2 authentication msgs;
/// don't accept more than one of each (to prevent DoS)
bool got_auth2;
/// we've send one <unauthorized>.
/// On next auth failure, disconnect
// keep track of whether we've got the 2 authentication msgs;
// don't accept more than one of each (to prevent DoS)
bool sent_unauthorized;
/// connection is from local host
// we've send one <unauthorized>.
// On next auth failure, disconnect
bool is_local;
// connection is from local host
int au_ss_state;
int au_mgr_state;
GUI_HTTP gui_http;
@ -89,8 +89,8 @@ class GUI_RPC_CONN_SET {
bool remote_hosts_file_exists;
public:
int lsock;
/// time of the last RPC that needs network access to handle
double time_of_last_rpc_needing_network;
// time of the last RPC that needs network access to handle
GUI_RPC_CONN_SET();
char password[256];

View File

@ -57,10 +57,10 @@ public:
PROXY_INFO pi;
char m_url[256];
/// string needed for ssl support
char m_curl_ca_bundle_location[256];
/// string needed for proxy username/password
// string needed for ssl support
char m_curl_user_credentials[128];
// string needed for proxy username/password
int content_length;
double file_offset;
@ -68,65 +68,64 @@ public:
char request_header[4096];
FILE* fileIn;
/// CMC need an output file for POST responses
FILE* fileOut;
/// the "easy curl" handle for this net_xfer request
// CMC need an output file for POST responses
CURL* curlEasy;
/// curl slist for http headers
// the "easy curl" handle for this net_xfer request
struct curl_slist *pcurlList;
/// a pointer to a form item for POST
// curl slist for http headers
struct curl_httppost *pcurlFormStart;
/// a pointer to a form item for POST
// a pointer to a form item for POST
struct curl_httppost *pcurlFormEnd;
/// pointer to bytes for reading via libcurl_read function
// a pointer to a form item for POST
unsigned char* pByte;
// pointer to bytes for reading via libcurl_read function
/// offset within the file or memory buffer we're reading,
long lSeek;
// offset within the file or memory buffer we're reading,
char infile[256];
char outfile[256];
/// put Curl error message here
char error_msg[256];
/// CMC -- flag that outfile is really a tempfile we should delete
// put Curl error message here
bool bTempOutfile;
// CMC -- flag that outfile is really a tempfile we should delete
char* req1;
int req1_len;
/// CMC -- a flag that I already sent the header
bool bSentHeader;
/// CMC -- send up curl result code
// CMC -- a flag that I already sent the header
CURLcode CurlResult;
// CMC -- send up curl result code
bool want_download; // at most one should be true
bool want_upload;
/// errno from connect() (not used for anything)
long connect_error;
/// HTTP status code from server
/// the above two MUST be long (not int)
/// otherwise breaks on 64-bit machines
// errno from connect() (not used for anything)
long response;
// HTTP status code from server
// the above two MUST be long (not int)
// otherwise breaks on 64-bit machines
double start_time;
/// Uncompressed bytes transferred.
/// In the case of "post2" this includes only the file part
/// In the case of restartable ops (file upload/download)
/// this includes previous count (i.e. file offset)
double bytes_xferred;
/// bytes_xferred at the start of this operation;
/// used to compute transfer speed
// Uncompressed bytes transferred.
// In the case of "post2" this includes only the file part
// In the case of restartable ops (file upload/download)
// this includes previous count (i.e. file offset)
double start_bytes_xferred;
/// tranfer rate based on elapsed time and bytes_xferred
/// (hence doesn't reflect compression; used only for GUI)
// bytes_xferred at the start of this operation;
// used to compute transfer speed
double xfer_speed;
// tranfer rate based on elapsed time and bytes_xferred
// (hence doesn't reflect compression; used only for GUI)
int http_op_state; // values above
/// HTTP_OP_* (see above)
int http_op_type;
/// Either:
/// 0
/// ERR_GETHOSTBYNAME (if no such host)
/// ERR_CONNECT (if server down)
/// ERR_FILE_NOT_FOUND (if 404)
/// ERR_HTTP_ERROR (other failures)
// HTTP_OP_* (see above)
int http_op_retval;
// Either:
// 0
// ERR_GETHOSTBYNAME (if no such host)
// ERR_CONNECT (if server down)
// ERR_FILE_NOT_FOUND (if 404)
// ERR_HTTP_ERROR (other failures)
void reset();
void init();
@ -154,14 +153,14 @@ public:
}
private:
// internal use in the class -- takes an init_get/post/post2 and turns it into
// an appropriate libcurl request
// take an init_get/post/post2 and turns it into a libcurl request
//
int libcurl_exec(const char* url, const char* in, const char* out,
double offset, bool bPost
);
};
/// represents a set of HTTP requests in progress
// represents a set of HTTP requests in progress
class HTTP_OP_SET {
std::vector<HTTP_OP*> http_ops;
@ -171,13 +170,13 @@ public:
int remove(HTTP_OP*);
int nops();
/// total bytes transferred
double bytes_up, bytes_down;
// total bytes transferred
void get_fdset(FDSET_GROUP&);
void got_select(FDSET_GROUP&, double);
/// lookup by easycurl handle
HTTP_OP* lookup_curl(CURL* pcurl);
// lookup by easycurl handle
void cleanup_temp_files();
};

View File

@ -31,19 +31,19 @@
class FILE_XFER_SET;
class HTTP_OP_SET;
/// there's one of these each for upload and download
// there's one of these each for upload and download
struct NET_INFO {
/// estimate of max transfer rate; computed as an average of
/// the rates of recent file transfers, weighted by file size.
/// This ignores concurrency of transfers.
double max_rate;
/// recent average transfer rate
// estimate of max transfer rate; computed as an average of
// the rates of recent file transfers, weighted by file size.
// This ignores concurrency of transfers.
double avg_rate;
/// when avg_rate was last updated
// recent average transfer rate
double avg_time;
/// updates the above vars
// when avg_rate was last updated
void update(double nbytes, double dt);
// updates the above vars
};
@ -60,24 +60,23 @@ public:
class NET_STATUS {
public:
/// contact the reference site as soon as GUI_HTTP is idle
/// polled from NET_STATS::poll(), for want of a better place
bool need_to_contact_reference_site;
// contact the reference site as soon as GUI_HTTP is idle
// polled from NET_STATS::poll(), for want of a better place
void contact_reference_site();
bool show_ref_message;
/// client wants to do network comm and no physical connection exists.
/// Initially false; set whenever a Curl operation
/// returns CURLE_COULDNT_RESOLVE_HOST,
/// and a subsequent request to a highly-available site
/// also returns CURLE_COULDNT_RESOLVE_HOST.
/// cleared whenever we transfer data,
/// or an operation returns some other value
bool need_physical_connection;
/// we have a network connection, but it's likely to go away soon,
/// so do as much network comm as possible
/// (e.g. report completed results)
// client wants to do network comm and no physical connection exists.
// Initially false; set whenever a Curl operation
// returns CURLE_COULDNT_RESOLVE_HOST,
// and a subsequent request to a highly-available site
// also returns CURLE_COULDNT_RESOLVE_HOST.
// cleared whenever we transfer data,
// or an operation returns some other value
bool have_sporadic_connection;
// we have a network connection, but it's likely to go away soon,
// so do as much network comm as possible
// (e.g. report completed results)
double last_comm_time;
int network_status();
@ -93,9 +92,9 @@ public:
void poll();
};
/// This is used to access a reference website (like yahoo or google)
/// that is assumed to be 100% available.
/// It is used ONLY from the HTTP code, when a transaction fails
// This is used to access a reference website (like yahoo or google)
// that is assumed to be 100% available.
// It is used ONLY from the HTTP code, when a transaction fails
struct LOOKUP_WEBSITE_OP: public GUI_HTTP_OP {
int error_num;

View File

@ -464,7 +464,14 @@ bool PERS_FILE_XFER_SET::poll() {
if (gstate.now - last_time < PERS_FILE_XFER_POLL_PERIOD) return false;
last_time = gstate.now;
// try to finish ones we've already started
//
for (i=0; i<pers_file_xfers.size(); i++) {
if (!pers_file_xfers[i]->last_bytes_xferred) continue;
action |= pers_file_xfers[i]->poll();
}
for (i=0; i<pers_file_xfers.size(); i++) {
if (pers_file_xfers[i]->last_bytes_xferred) continue;
action |= pers_file_xfers[i]->poll();
}

View File

@ -27,78 +27,78 @@
#define PERS_GIVEUP (SECONDS_PER_DAY*90)
// give up on xfer if this time elapses since last byte xferred
/// PERS_FILE_XFER represents a "persistent file transfer",
/// i.e. a long-term effort to upload or download a file.
/// This may consist of several "episodes",
/// which are HTTP operations to a particular server.
/// PERS_FILE_XFER manages
/// - the choice of data servers
/// - the retry and giveup policies
/// - restarting partial transfers
///
/// The FILE_INFO has a list of URLs.
/// For download, the object attempts to download the file
/// from any combination of the URLs.
/// For upload, try to upload the file in its entirety to one of the URLs.
// PERS_FILE_XFER represents a "persistent file transfer",
// i.e. a long-term effort to upload or download a file.
// This may consist of several "episodes",
// which are HTTP operations to a particular server.
// PERS_FILE_XFER manages
// - the choice of data servers
// - the retry and giveup policies
// - restarting partial transfers
//
// The FILE_INFO has a list of URLs.
// For download, the object attempts to download the file
// from any combination of the URLs.
// For upload, try to upload the file in its entirety to one of the URLs.
/// a PERS_FILE_XFER is created and added to pers_file_xfer_set
/// 1) when read from the client state file
/// in (FILE_INFO::parse(), CLIENT_STATE::parse_state_file()
/// 2) when a FILE_INFO is ready to transfer
/// in CLIENT_STATE::handle_pers_file_xfers()
// a PERS_FILE_XFER is created and added to pers_file_xfer_set
// 1) when read from the client state file
// in (FILE_INFO::parse(), CLIENT_STATE::parse_state_file()
// 2) when a FILE_INFO is ready to transfer
// in CLIENT_STATE::handle_pers_file_xfers()
/// a PERS_FILE_XFER p is removed from pers_file_xfer_set and freed
/// 1) when p->pers_xfer_done is true
/// in CLIENT_STATE::handle_pers_file_xfers()
// a PERS_FILE_XFER p is removed from pers_file_xfer_set and freed
// 1) when p->pers_xfer_done is true
// in CLIENT_STATE::handle_pers_file_xfers()
/// A FILE_XFER is created and added to file_xfer_set and linked from PFX
/// 1) in PERS_FILE_XFER::start_xfer()
// A FILE_XFER is created and added to file_xfer_set and linked from PFX
// 1) in PERS_FILE_XFER::start_xfer()
/// A FILE_XFER is erased from file_xfer_set, unlinked from PFX and freed
/// 1) when the FILE_XFER is done, in
/// PERS_FILE_XFER::poll()
/// PERS_FILE_XFER::check_giveup()
/// 2) user request, in
/// PERS_FILE_XFER::abort()
/// PERS_FILE_XFER::suspend()
/// 3) if the FILE_XFER_SET::insert() fails
/// PERS_FILE_XFER::start_xfer()
/// NOTE: when this is done, pers_xfer_done is set
///
/// pointers:
/// PERS_FILE_XFER -> FILE_XFER
/// set in PERS_FILE_XFER::start_xfer()
/// zeroed (see above)
/// PERS_FILE_XFER -> FILE_INFO
/// set in PERS_FILE_XFER::init()
/// FILE_INFO -> PERS_FILE_XFER
/// set in FILE_INFO::parse(), CLIENT_STATE::handle_pers_file_xfers()
/// zeroed in PERS_FILE_XFER destructor
// A FILE_XFER is erased from file_xfer_set, unlinked from PFX and freed
// 1) when the FILE_XFER is done, in
// PERS_FILE_XFER::poll()
// PERS_FILE_XFER::check_giveup()
// 2) user request, in
// PERS_FILE_XFER::abort()
// PERS_FILE_XFER::suspend()
// 3) if the FILE_XFER_SET::insert() fails
// PERS_FILE_XFER::start_xfer()
// NOTE: when this is done, pers_xfer_done is set
//
// pointers:
// PERS_FILE_XFER -> FILE_XFER
// set in PERS_FILE_XFER::start_xfer()
// zeroed (see above)
// PERS_FILE_XFER -> FILE_INFO
// set in PERS_FILE_XFER::init()
// FILE_INFO -> PERS_FILE_XFER
// set in FILE_INFO::parse(), CLIENT_STATE::handle_pers_file_xfers()
// zeroed in PERS_FILE_XFER destructor
class PERS_FILE_XFER {
/// # of retries so far
int nretry;
/// time of first transfer request
// # of retries so far
double first_request_time;
// time of first transfer request
void do_backoff();
public:
bool is_upload;
/// time to next retry the file request
double next_request_time;
/// Total time there's been an active FILE_XFER for this PFX
/// Currently not used for anything; not meaningful for throughput
/// because could include repeated transfer
// time to next retry the file request
double time_so_far;
/// when the above was last updated.
/// Defined only while a transfer is active
// Total time there's been an active FILE_XFER for this PFX
// Currently not used for anything; not meaningful for throughput
// because could include repeated transfer
double last_time;
/// Save how much is transferred when transfer isn't active, used
/// to display progress in GUI.
// when the above was last updated.
// Defined only while a transfer is active
double last_bytes_xferred;
// Save how much is transferred when transfer isn't active, used
// to display progress in GUI.
bool pers_xfer_done;
/// nonzero if file xfer in progress
FILE_XFER* fxp;
// nonzero if file xfer in progress
FILE_INFO* fip;
PERS_FILE_XFER();

View File

@ -21,10 +21,10 @@
struct RESULT;
struct RR_SIM_PROJECT_STATUS {
/// jobs currently running (in simulation)
std::vector<RESULT*>active;
/// CPU jobs runnable but not running yet
// jobs currently running (in simulation)
std::vector<RESULT*>pending;
// CPU jobs runnable but not running yet
inline void clear() {
active.clear();

View File

@ -49,10 +49,10 @@
#define SCHED_RETRY_DELAY_MAX (60*60*4) // 4 hours
/// SCHEDULER_OP encapsulates the mechanism for
/// 1) fetching master files
/// 2) communicating with scheduling servers
/// Only one such operation can be in progress at once.
// SCHEDULER_OP encapsulates the mechanism for
// 1) fetching master files
// 2) communicating with scheduling servers
// Only one such operation can be in progress at once.
class SCHEDULER_OP {
private:
@ -60,15 +60,15 @@ private:
HTTP_OP http_op;
HTTP_OP_SET* http_ops;
char scheduler_url[256];
/// index within project's URL list
int url_index;
// index within project's URL list
public:
/// project we're currently contacting
PROJECT* cur_proj;
// project we're currently contacting
int state;
int reason;
/// used to randomize order
double url_random;
// used to randomize order
public:
SCHEDULER_OP(HTTP_OP_SET*);
@ -77,8 +77,8 @@ public:
int init_master_fetch(PROJECT*);
bool check_master_fetch_start();
void backoff(PROJECT* p, const char *error_msg);
/// if we're doing an op to this project, abort it
void abort(PROJECT*);
// if we're doing an op to this project, abort it
private:
bool update_urls(PROJECT*, std::vector<std::string> &urls);
int start_op(PROJECT*);
@ -98,12 +98,12 @@ struct SCHEDULER_REPLY {
double request_delay;
double next_rpc_delay;
std::vector<USER_MESSAGE> messages;
/// not including <global_preferences> tags;
/// may include <venue> elements
char* global_prefs_xml;
/// not including <project_preferences> tags
/// may include <venue> elements
// not including <global_preferences> tags;
// may include <venue> elements
char* project_prefs_xml;
// not including <project_preferences> tags
// may include <venue> elements
char master_url[256];
char host_venue[256];
unsigned int user_create_time;

View File

@ -27,21 +27,16 @@ class TIME_STATS {
public:
double last_update;
// we maintain an exponentially weighted average of these quantities:
/// the fraction of total time this host runs the core client
double on_frac;
/// of the time this host runs the core client,
/// the fraction it is connected to the Internet,
/// or -1 if not known
// the fraction of total time this host runs the core client
double connected_frac;
/// of the time this host runs the core client,
/// the fraction it is enabled to work
/// (as determined by preferences, manual suspend/resume, etc.)
// of the time this host runs the core client,
// the fraction it is connected to the Internet,
// or -1 if not known
double active_frac;
/// The ratio between CPU time accumulated by BOINC apps
/// and the wall time those apps are scheduled at the OS level.
/// May be less than one if
/// 1) apps page or do I/O
/// 2) other CPU-intensive apps run
// of the time this host runs the core client,
// the fraction it is enabled to work
// (as determined by preferences, manual suspend/resume, etc.)
FILE* time_stats_log;
double inactive_start;