2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2003-07-03 00:48:43 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC 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 3 of the License, or (at your option) any later version.
|
2003-07-03 00:48:43 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// 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
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
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__)
|
2009-02-26 00:23:23 +00:00
|
|
|
#include <cstdio>
|
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"
|
2008-09-04 12:50:54 +00:00
|
|
|
#include "cert_sig.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "hostinfo.h"
|
2008-03-27 18:25:29 +00:00
|
|
|
#include "coproc.h"
|
2004-06-12 04:45:36 +00:00
|
|
|
#include "miofile.h"
|
2009-02-26 17:12:55 +00:00
|
|
|
#include "common_defs.h"
|
2011-06-25 05:13:56 +00:00
|
|
|
#include "cc_config.h"
|
2009-02-26 17:12:55 +00:00
|
|
|
|
2008-10-28 21:59:25 +00:00
|
|
|
#include "rr_sim.h"
|
2009-02-26 17:12:55 +00:00
|
|
|
#include "work_fetch.h"
|
2009-12-21 17:49:28 +00:00
|
|
|
#include "cs_notice.h"
|
2011-09-20 18:49:38 +00:00
|
|
|
#include "cs_trickle.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2010-09-24 20:02:42 +00:00
|
|
|
#ifdef SIM
|
|
|
|
#include "sim.h"
|
|
|
|
#endif
|
|
|
|
|
2005-10-03 18:05:58 +00:00
|
|
|
#define MAX_FILE_INFO_LEN 4096
|
|
|
|
#define MAX_SIGNATURE_LEN 4096
|
|
|
|
#define MAX_KEY_LEN 4096
|
|
|
|
|
2009-09-22 21:02:06 +00:00
|
|
|
#define MAX_COPROCS_PER_JOB 8
|
2011-03-25 03:44:09 +00:00
|
|
|
// max # of instances of a GPU that a job can use
|
|
|
|
|
|
|
|
extern int rsc_index(const char*);
|
|
|
|
extern const char* rsc_name(int);
|
|
|
|
extern COPROCS coprocs;
|
2009-09-22 21:02:06 +00:00
|
|
|
|
2011-07-20 19:12:10 +00:00
|
|
|
struct FILE_INFO;
|
|
|
|
|
|
|
|
// represents a list of URLs (e.g. to download a file)
|
|
|
|
// and a current position in that list
|
|
|
|
//
|
|
|
|
struct URL_LIST {
|
|
|
|
std::vector<std::string> urls;
|
|
|
|
int start_index;
|
|
|
|
int current_index;
|
|
|
|
|
|
|
|
URL_LIST(){};
|
|
|
|
|
|
|
|
void clear() {
|
|
|
|
urls.clear();
|
|
|
|
start_index = -1;
|
|
|
|
current_index = -1;
|
|
|
|
}
|
|
|
|
bool empty() {return urls.empty();}
|
|
|
|
const char* get_init_url();
|
|
|
|
const char* get_next_url();
|
|
|
|
const char* get_current_url(FILE_INFO&);
|
|
|
|
inline void add(std::string url) {
|
|
|
|
urls.push_back(url);
|
|
|
|
}
|
|
|
|
void replace(URL_LIST& ul) {
|
|
|
|
clear();
|
|
|
|
for (unsigned int i=0; i<ul.urls.size(); i++) {
|
|
|
|
add(ul.urls[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-10-11 17:41:10 +00:00
|
|
|
// Values of FILE_INFO::status.
|
2003-11-02 22:51:49 +00:00
|
|
|
// If the status is neither of these two,
|
2011-10-11 17:41:10 +00:00
|
|
|
// it's an error code indicating an unrecoverable error
|
|
|
|
// in the transfer 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
|
|
|
|
|
2009-12-21 19:20:28 +00:00
|
|
|
struct FILE_INFO {
|
2003-11-02 22:51:49 +00:00
|
|
|
char name[256];
|
|
|
|
char md5_cksum[33];
|
|
|
|
double max_nbytes;
|
|
|
|
double nbytes;
|
|
|
|
double upload_offset;
|
2011-10-11 17:41:10 +00:00
|
|
|
int status; // see above
|
2003-11-02 22:51:49 +00:00
|
|
|
bool executable; // change file protections to make executable
|
|
|
|
bool uploaded; // file has been uploaded
|
|
|
|
bool sticky; // don't delete unless instructed to do so
|
|
|
|
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-12-12 23:32:25 +00:00
|
|
|
bool is_auto_update_file;
|
2011-07-20 19:12:10 +00:00
|
|
|
bool anonymous_platform_file;
|
2006-06-20 22:03:15 +00:00
|
|
|
bool gzip_when_done;
|
2010-04-01 05:54:29 +00:00
|
|
|
// for output files: gzip file when done, and append .gz to its name
|
2006-11-26 02:06:30 +00:00
|
|
|
class PERS_FILE_XFER* pers_file_xfer;
|
2010-04-01 05:54:29 +00:00
|
|
|
// nonzero if in the process of being up/downloaded
|
2009-12-21 19:20:28 +00:00
|
|
|
RESULT* result;
|
2010-04-01 05:54:29 +00:00
|
|
|
// for upload files (to authenticate)
|
2009-12-21 19:20:28 +00:00
|
|
|
PROJECT* project;
|
2003-11-02 22:51:49 +00:00
|
|
|
int ref_cnt;
|
2011-07-20 19:12:10 +00:00
|
|
|
URL_LIST download_urls;
|
|
|
|
URL_LIST upload_urls;
|
- client: add a mechanism for restartable download of compressed files.
(It turns out that the compression schemes supported by
Apache and libcurl, suprisingly, aren't restartable.)
if a <file_info> from the server contains <gzipped_url> tags,
use those instead of the <url> tags,
and flag the file as "download_gzipped".
If this is the case, download NAME.gz and save it as NAME.gzt.
When the download is complete, rename NAME.gzt to NAME.gz,
and uncompress it to NAME.
(this ensures that if NAME.gz is present, it's complete).
Also do the uncompression, if needed, in verify_file().
This ensures that the uncompression will eventually get done
even if the client quits are crashes in the middle.
- update_versions: if <gzip> is present in a <file_info>,
add a gzipped copy in the download directory
and add a <gzipped_url> elements to the app version's xml_doc.
svn path=/trunk/boinc/; revision=25112
2012-01-20 23:34:15 +00:00
|
|
|
bool download_gzipped;
|
|
|
|
// if set, download NAME.gz and gunzip it to NAME
|
2005-10-03 18:05:58 +00:00
|
|
|
char xml_signature[MAX_SIGNATURE_LEN];
|
2011-07-20 20:08:05 +00:00
|
|
|
// the upload signature
|
2005-10-03 18:05:58 +00:00
|
|
|
char file_signature[MAX_SIGNATURE_LEN];
|
2010-04-01 05:54:29 +00:00
|
|
|
// if the file itself is signed (for executable files)
|
|
|
|
// this is the signature
|
2008-10-04 23:44:24 +00:00
|
|
|
std::string error_msg;
|
2010-04-01 05:54:29 +00:00
|
|
|
// if permanent error occurs during file xfer, it's recorded here
|
2008-09-04 12:50:54 +00:00
|
|
|
CERT_SIGS* cert_sigs;
|
2003-11-02 22:51:49 +00:00
|
|
|
|
|
|
|
FILE_INFO();
|
2010-09-13 21:20:30 +00:00
|
|
|
~FILE_INFO(){}
|
2004-09-02 16:23:21 +00:00
|
|
|
void reset();
|
2003-11-02 22:51:49 +00:00
|
|
|
int set_permissions();
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse(XML_PARSER&);
|
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&);
|
2008-10-04 23:44:24 +00:00
|
|
|
int delete_file();
|
2010-04-01 05:54:29 +00:00
|
|
|
// attempt to delete the underlying file
|
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&);
|
2007-01-19 20:56:49 +00:00
|
|
|
int verify_file(bool, bool);
|
2008-09-04 12:17:58 +00:00
|
|
|
bool verify_file_certs();
|
2008-10-04 23:44:24 +00:00
|
|
|
int gzip();
|
2010-04-01 05:54:29 +00:00
|
|
|
// gzip file and add .gz to name
|
- client: add a mechanism for restartable download of compressed files.
(It turns out that the compression schemes supported by
Apache and libcurl, suprisingly, aren't restartable.)
if a <file_info> from the server contains <gzipped_url> tags,
use those instead of the <url> tags,
and flag the file as "download_gzipped".
If this is the case, download NAME.gz and save it as NAME.gzt.
When the download is complete, rename NAME.gzt to NAME.gz,
and uncompress it to NAME.
(this ensures that if NAME.gz is present, it's complete).
Also do the uncompression, if needed, in verify_file().
This ensures that the uncompression will eventually get done
even if the client quits are crashes in the middle.
- update_versions: if <gzip> is present in a <file_info>,
add a gzipped copy in the download directory
and add a <gzipped_url> elements to the app version's xml_doc.
svn path=/trunk/boinc/; revision=25112
2012-01-20 23:34:15 +00:00
|
|
|
int gunzip();
|
|
|
|
// unzip file and remove .gz from filename
|
2011-07-20 19:12:10 +00:00
|
|
|
inline bool uploadable() {
|
|
|
|
return !upload_urls.empty();
|
|
|
|
}
|
|
|
|
inline bool downloadable() {
|
|
|
|
return !download_urls.empty();
|
|
|
|
}
|
|
|
|
inline URL_LIST& get_url_list(bool is_upload) {
|
|
|
|
return is_upload?upload_urls:download_urls;
|
|
|
|
}
|
2003-11-02 22:51:49 +00:00
|
|
|
};
|
|
|
|
|
2011-02-10 22:45:39 +00:00
|
|
|
// Describes a connection between a file and a workunit, result, or app version
|
|
|
|
//
|
2003-11-02 22:51:49 +00:00
|
|
|
struct FILE_REF {
|
2008-10-04 23:44:24 +00:00
|
|
|
char file_name[256];
|
2010-04-01 05:54:29 +00:00
|
|
|
// physical name
|
2008-10-04 23:44:24 +00:00
|
|
|
char open_name[256];
|
2010-04-01 05:54:29 +00:00
|
|
|
// logical name
|
2003-11-02 22:51:49 +00:00
|
|
|
bool main_program;
|
|
|
|
FILE_INFO* file_info;
|
2007-04-13 22:55:18 +00:00
|
|
|
bool copy_file;
|
2010-04-01 05:54:29 +00:00
|
|
|
// if true, core client will copy the file instead of linking
|
2006-10-20 20:21:33 +00:00
|
|
|
bool optional;
|
2010-04-01 05:54:29 +00:00
|
|
|
// for output files: app may not generate file;
|
|
|
|
// don't treat as error if file is missing.
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse(XML_PARSER&);
|
2004-06-12 04:45:36 +00:00
|
|
|
int write(MIOFILE&);
|
2003-11-02 22:51:49 +00:00
|
|
|
};
|
|
|
|
|
2009-07-16 16:35:57 +00:00
|
|
|
// file xfer backoff state for a project and direction (up/down)
|
|
|
|
// if file_xfer_failures exceeds FILE_XFER_FAILURE_LIMIT,
|
|
|
|
// we switch from a per-file to a project-wide backoff policy
|
|
|
|
// (separately for the up/down directions)
|
|
|
|
// NOTE: this refers to transient failures, not permanent.
|
|
|
|
//
|
|
|
|
#define FILE_XFER_FAILURE_LIMIT 3
|
|
|
|
struct FILE_XFER_BACKOFF {
|
|
|
|
int file_xfer_failures;
|
|
|
|
// count of consecutive failures
|
|
|
|
double next_xfer_time;
|
|
|
|
// when to start trying again
|
|
|
|
bool ok_to_transfer();
|
|
|
|
void file_xfer_failed(PROJECT*);
|
|
|
|
void file_xfer_succeeded();
|
|
|
|
|
|
|
|
FILE_XFER_BACKOFF() {
|
|
|
|
file_xfer_failures = 0;
|
|
|
|
next_xfer_time = 0;
|
|
|
|
}
|
2011-11-20 09:18:12 +00:00
|
|
|
|
|
|
|
// clear backoff but maintain failure count;
|
|
|
|
// called when network becomes available
|
|
|
|
//
|
|
|
|
void clear_temporary() {
|
|
|
|
next_xfer_time = 0;
|
|
|
|
}
|
2009-07-16 16:35:57 +00:00
|
|
|
};
|
|
|
|
|
2010-04-01 05:54:29 +00:00
|
|
|
// statistics at a specific day
|
2008-10-04 23:44:24 +00:00
|
|
|
|
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
|
|
|
};
|
2007-01-11 00:20:58 +00:00
|
|
|
bool operator < (const DAILY_STATS&, const DAILY_STATS&);
|
2009-07-16 16:35:57 +00:00
|
|
|
|
2010-09-08 18:06:56 +00:00
|
|
|
// base class for PROJECT and ACCT_MGR_INFO
|
|
|
|
//
|
|
|
|
struct PROJ_AM {
|
|
|
|
char master_url[256];
|
|
|
|
char project_name[256];
|
|
|
|
// descriptive. not unique
|
|
|
|
std::vector<RSS_FEED> proj_feeds;
|
|
|
|
inline char *get_project_name() {
|
|
|
|
if (strlen(project_name)) {
|
|
|
|
return project_name;
|
|
|
|
} else {
|
|
|
|
return master_url;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PROJECT : PROJ_AM {
|
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
|
|
|
|
//
|
2008-10-04 23:44:24 +00:00
|
|
|
char authenticator[256];
|
2010-04-01 05:54:29 +00:00
|
|
|
// user's authenticator on this project
|
2004-06-30 18:17:21 +00:00
|
|
|
std::string project_prefs;
|
2010-04-01 05:54:29 +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;
|
2010-04-01 05:54:29 +00:00
|
|
|
// without enclosing <project_specific> tags
|
|
|
|
// Does not include <venue> elements
|
2004-09-27 19:44:40 +00:00
|
|
|
std::string gui_urls;
|
2010-04-01 05:54:29 +00:00
|
|
|
// GUI URLs, with enclosing <gui_urls> tags
|
2003-11-28 19:19:11 +00:00
|
|
|
double resource_share;
|
2010-04-01 05:54:29 +00:00
|
|
|
// project's resource share relative to other projects.
|
2010-11-23 19:39:47 +00:00
|
|
|
double resource_share_frac;
|
|
|
|
// fraction of RS of non-suspended, compute-intensive projects
|
2010-04-01 05:54:29 +00:00
|
|
|
|
2010-12-13 22:58:15 +00:00
|
|
|
// the following are from the user's project prefs
|
2010-11-10 20:23:20 +00:00
|
|
|
//
|
2011-03-25 03:44:09 +00:00
|
|
|
bool no_rsc_pref[MAX_RSC];
|
2010-03-29 19:08:19 +00:00
|
|
|
|
2011-07-29 00:07:20 +00:00
|
|
|
// derived from GPU exclusions in cc_config.xml;
|
|
|
|
// disable work fetch if all instances excluded
|
2011-06-24 03:33:22 +00:00
|
|
|
//
|
2011-07-29 00:07:20 +00:00
|
|
|
bool no_rsc_config[MAX_RSC];
|
2011-06-24 03:33:22 +00:00
|
|
|
|
2010-11-10 20:23:20 +00:00
|
|
|
// the following are from the project itself
|
|
|
|
// (or derived from app version list if anonymous platform)
|
|
|
|
//
|
2011-03-25 03:44:09 +00:00
|
|
|
bool no_rsc_apps[MAX_RSC];
|
2010-03-29 19:08:19 +00:00
|
|
|
|
2010-12-01 18:04:18 +00:00
|
|
|
// the following are from the account manager, if any
|
|
|
|
//
|
2011-03-25 03:44:09 +00:00
|
|
|
bool no_rsc_ams[MAX_RSC];
|
2010-12-01 18:04:18 +00:00
|
|
|
|
2010-11-10 20:23:20 +00:00
|
|
|
// the following set dynamically
|
2010-12-01 18:04:18 +00:00
|
|
|
//
|
2011-03-25 03:44:09 +00:00
|
|
|
bool rsc_defer_sched[MAX_RSC];
|
|
|
|
// This project has a GPU job for which there's insuff. video RAM.
|
|
|
|
// Don't fetch more jobs of this type; they might have same problem
|
2009-10-23 21:57:58 +00:00
|
|
|
|
2004-10-01 08:15:58 +00:00
|
|
|
char host_venue[256];
|
2010-04-01 05:54:29 +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;
|
2010-04-01 05:54:29 +00:00
|
|
|
// where to find scheduling servers
|
2008-10-04 23:44:24 +00:00
|
|
|
char symstore[256];
|
2010-04-01 05:54:29 +00:00
|
|
|
// 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];
|
2007-09-03 23:00:22 +00:00
|
|
|
double cpid_time;
|
2006-05-23 06:46:19 +00:00
|
|
|
double user_total_credit;
|
|
|
|
double user_expavg_credit;
|
|
|
|
double user_create_time;
|
2011-01-13 22:40:48 +00:00
|
|
|
int userid;
|
|
|
|
int teamid;
|
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;
|
2010-01-28 05:21:14 +00:00
|
|
|
// resource share according to AMS; overrides project
|
|
|
|
// -1 means not specified by AMS
|
2006-05-23 06:46:19 +00:00
|
|
|
|
|
|
|
// stuff related to scheduler RPCs and master fetch
|
|
|
|
//
|
|
|
|
int rpc_seqno;
|
2008-10-04 23:44:24 +00:00
|
|
|
int nrpc_failures;
|
2010-04-01 05:54:29 +00:00
|
|
|
// # of consecutive times we've failed to contact all scheduling servers
|
2003-02-28 23:14:18 +00:00
|
|
|
int master_fetch_failures;
|
2008-10-04 23:44:24 +00:00
|
|
|
double min_rpc_time;
|
2010-04-01 05:54:29 +00:00
|
|
|
// earliest time to contact any server of this project (or zero)
|
2006-12-21 16:56:33 +00:00
|
|
|
void set_min_rpc_time(double future_time, const char* reason);
|
2008-10-14 21:40:14 +00:00
|
|
|
double next_rpc_time;
|
2010-04-01 05:54:29 +00:00
|
|
|
// if nonzero, specifies a time when another scheduler RPC
|
|
|
|
// should be done (as requested by server).
|
|
|
|
// An RPC could be done sooner than this.
|
2006-05-23 06:46:19 +00:00
|
|
|
bool waiting_until_min_rpc_time();
|
2010-04-01 05:54:29 +00:00
|
|
|
// returns true if min_rpc_time > now
|
2002-07-15 05:34:32 +00:00
|
|
|
bool master_url_fetch_pending;
|
2010-04-01 05:54:29 +00:00
|
|
|
// need to fetch and parse the master URL
|
2006-08-24 20:33:46 +00:00
|
|
|
int sched_rpc_pending;
|
2010-04-01 05:54:29 +00:00
|
|
|
// 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
|
2006-11-08 00:20:16 +00:00
|
|
|
bool possibly_backed_off;
|
2010-04-01 05:54:29 +00:00
|
|
|
// 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
|
2008-10-04 23:44:24 +00:00
|
|
|
bool trickle_up_pending;
|
2010-04-01 05:54:29 +00:00
|
|
|
// have trickle up to send
|
2008-10-04 23:44:24 +00:00
|
|
|
double last_rpc_time;
|
2010-04-01 05:54:29 +00:00
|
|
|
// when last RPC finished
|
2006-10-12 19:43:55 +00:00
|
|
|
|
|
|
|
// Other stuff
|
|
|
|
|
2008-10-04 23:44:24 +00:00
|
|
|
bool anonymous_platform;
|
2010-04-01 05:54:29 +00:00
|
|
|
// app_versions.xml file found in project dir;
|
|
|
|
// use those apps rather then getting from server
|
2004-09-23 22:27:41 +00:00
|
|
|
bool non_cpu_intensive;
|
2011-05-25 21:16:45 +00:00
|
|
|
// All this project's apps are non-CPU-intensive.
|
|
|
|
// Apps can also be individually marked as NCI
|
2006-06-20 17:36:28 +00:00
|
|
|
bool verify_files_on_app_start;
|
2011-05-25 21:16:45 +00:00
|
|
|
// Check app version and input files on app startup,
|
|
|
|
// to make sure they haven't been tampered with.
|
|
|
|
// This provides only the illusion of security.
|
2008-04-14 04:04:45 +00:00
|
|
|
bool use_symlinks;
|
2011-12-28 14:52:03 +00:00
|
|
|
double disk_usage;
|
|
|
|
// computed by get_disk_usages()
|
2012-01-02 05:53:42 +00:00
|
|
|
double disk_share;
|
|
|
|
// computed by get_disk_shares();
|
2007-04-13 22:55:18 +00:00
|
|
|
|
|
|
|
// items send in scheduler replies, requesting that
|
|
|
|
// various things be sent in the next request
|
|
|
|
//
|
|
|
|
int send_time_stats_log;
|
2010-04-01 05:54:29 +00:00
|
|
|
// if nonzero, send time stats log from that point on
|
2007-04-13 22:55:18 +00:00
|
|
|
int send_job_log;
|
2010-04-01 05:54:29 +00:00
|
|
|
// if nonzero, send this project's job log from that point on
|
2010-05-13 20:18:27 +00:00
|
|
|
bool send_full_workload;
|
2007-04-13 22:55:18 +00:00
|
|
|
|
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;
|
2010-04-01 05:54:29 +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;
|
2007-02-23 20:24:52 +00:00
|
|
|
bool detach_when_done;
|
2010-04-01 05:54:29 +00:00
|
|
|
// when no results for this project, detach it.
|
2007-05-24 16:07:21 +00:00
|
|
|
bool ended;
|
2010-04-01 05:54:29 +00:00
|
|
|
// project has ended; advise user to detach
|
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;
|
2010-04-01 05:54:29 +00:00
|
|
|
// files not specific to apps or work - e.g. icons
|
2003-11-02 22:51:49 +00:00
|
|
|
int parse_preferences_for_user_files();
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse_project_files(XML_PARSER&, 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;
|
2010-04-01 05:54:29 +00:00
|
|
|
// when last project file download finished
|
2006-10-12 19:43:55 +00:00
|
|
|
void update_project_files_downloaded_time();
|
2010-04-01 05:54:29 +00:00
|
|
|
// 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
|
|
|
|
|
|
|
double duration_correction_factor;
|
2010-04-01 05:54:29 +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.
|
2010-07-19 16:44:43 +00:00
|
|
|
//
|
|
|
|
// Deprecated - current server logic handles this,
|
|
|
|
// and this should go to 1.
|
|
|
|
// But we need to keep it around for older projects
|
2008-12-02 22:19:39 +00:00
|
|
|
void update_duration_correction_factor(ACTIVE_TASK*);
|
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
|
|
|
|
|
2008-12-31 23:07:59 +00:00
|
|
|
bool can_request_work();
|
2010-04-01 05:54:29 +00:00
|
|
|
// not suspended and not deferred and not no more work
|
2009-12-02 03:41:52 +00:00
|
|
|
bool runnable(int rsc_type);
|
2010-04-01 05:54:29 +00:00
|
|
|
// has a runnable result using the given resource type
|
2005-06-07 21:21:35 +00:00
|
|
|
bool downloading();
|
2010-04-01 05:54:29 +00:00
|
|
|
// has a result in downloading state
|
2005-06-07 19:22:50 +00:00
|
|
|
bool potentially_runnable();
|
2010-04-01 05:54:29 +00:00
|
|
|
// runnable or contactable or downloading
|
2006-06-15 23:15:27 +00:00
|
|
|
bool nearly_runnable();
|
2010-04-01 05:54:29 +00:00
|
|
|
// runnable or downloading
|
2006-06-15 23:15:27 +00:00
|
|
|
bool overworked();
|
2010-04-01 05:54:29 +00:00
|
|
|
// the project has used too much CPU time recently
|
2006-11-21 20:57:36 +00:00
|
|
|
bool some_download_stalled();
|
2010-04-01 05:54:29 +00:00
|
|
|
// a download is backed off
|
2006-11-26 02:06:30 +00:00
|
|
|
bool some_result_suspended();
|
2010-12-13 22:58:15 +00:00
|
|
|
double last_upload_start;
|
|
|
|
// the last time an upload was started.
|
|
|
|
// Used for "work fetch deferral" mechanism:
|
|
|
|
// don't request work from a project if an upload started
|
|
|
|
// in last X minutes and is still active
|
|
|
|
bool uploading();
|
2011-10-07 21:20:42 +00:00
|
|
|
bool has_results();
|
2005-06-07 18:30:36 +00:00
|
|
|
|
2005-06-01 05:49:51 +00:00
|
|
|
struct RESULT *next_runnable_result;
|
2010-04-01 05:54:29 +00:00
|
|
|
// the next result to run for this project
|
2007-01-25 21:36:27 +00:00
|
|
|
int nuploading_results;
|
2010-04-01 05:54:29 +00:00
|
|
|
// number of results in UPLOADING state
|
|
|
|
// Don't start new results if these exceeds 2*ncpus.
|
2009-07-22 22:00:51 +00:00
|
|
|
bool too_many_uploading_results;
|
2005-05-09 04:49:56 +00:00
|
|
|
|
2011-10-03 06:18:58 +00:00
|
|
|
// scheduling (work fetch and job scheduling)
|
|
|
|
//
|
|
|
|
double sched_priority;
|
|
|
|
void compute_sched_priority();
|
|
|
|
|
2011-03-03 20:32:54 +00:00
|
|
|
// stuff for RR sim
|
|
|
|
//
|
|
|
|
double rr_sim_cpu_share;
|
2011-08-08 19:07:54 +00:00
|
|
|
bool rr_sim_active;
|
2011-10-01 16:23:28 +00:00
|
|
|
int ncoprocs_excluded[MAX_RSC];
|
|
|
|
// number of excluded instances per processor type
|
2011-10-24 17:53:09 +00:00
|
|
|
bool operator<(const PROJECT& p) {
|
|
|
|
return sched_priority > p.sched_priority;
|
|
|
|
}
|
2011-03-03 20:32:54 +00:00
|
|
|
|
2008-12-31 23:07:59 +00:00
|
|
|
// stuff related to work fetch
|
|
|
|
//
|
2011-03-25 03:44:09 +00:00
|
|
|
RSC_PROJECT_WORK_FETCH rsc_pwf[MAX_RSC];
|
2008-12-31 23:07:59 +00:00
|
|
|
PROJECT_WORK_FETCH pwf;
|
2009-01-23 18:29:28 +00:00
|
|
|
inline void reset() {
|
2011-03-25 03:44:09 +00:00
|
|
|
for (int i=0; i<coprocs.n_rsc; i++) {
|
|
|
|
rsc_pwf[i].reset();
|
|
|
|
}
|
2008-12-31 23:07:59 +00:00
|
|
|
}
|
2010-03-05 21:13:53 +00:00
|
|
|
inline int deadlines_missed(int rsc_type) {
|
2011-03-25 03:44:09 +00:00
|
|
|
return rsc_pwf[rsc_type].deadlines_missed;
|
2010-03-05 21:13:53 +00:00
|
|
|
}
|
2010-11-17 20:04:58 +00:00
|
|
|
void get_task_durs(double& not_started_dur, double& in_progress_dur);
|
2005-06-01 05:49:51 +00:00
|
|
|
|
2005-05-31 23:43:34 +00:00
|
|
|
int nresults_returned;
|
2010-04-01 05:54:29 +00:00
|
|
|
// # 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);
|
2010-04-01 05:54:29 +00:00
|
|
|
// get scheduler URL with random offset r
|
2004-08-21 23:11:19 +00:00
|
|
|
bool checked;
|
2010-04-01 05:54:29 +00:00
|
|
|
// temporary used when scanning projects
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2009-07-16 16:35:57 +00:00
|
|
|
FILE_XFER_BACKOFF download_backoff;
|
|
|
|
FILE_XFER_BACKOFF upload_backoff;
|
|
|
|
inline FILE_XFER_BACKOFF& file_xfer_backoff(bool is_upload) {
|
|
|
|
return is_upload?upload_backoff:download_backoff;
|
|
|
|
}
|
2005-09-30 21:29:31 +00:00
|
|
|
|
2011-09-20 18:49:38 +00:00
|
|
|
// support for replicated trickle-ups
|
|
|
|
//
|
|
|
|
std::vector<TRICKLE_UP_OP*> trickle_up_ops;
|
|
|
|
|
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-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();
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse_state(XML_PARSER&);
|
2004-07-19 19:40:06 +00:00
|
|
|
int write_state(MIOFILE&, bool gui_rpc=false);
|
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();
|
2010-09-24 20:02:42 +00:00
|
|
|
|
2010-11-17 20:04:58 +00:00
|
|
|
void suspend();
|
|
|
|
void resume();
|
|
|
|
void abort_not_started();
|
|
|
|
// abort unstarted jobs
|
|
|
|
|
2010-12-01 18:04:18 +00:00
|
|
|
// clear AMS-related fields
|
|
|
|
inline void detach_ams() {
|
|
|
|
attached_via_acct_mgr = false;
|
|
|
|
ams_resource_share = -1;
|
2011-03-25 03:44:09 +00:00
|
|
|
for (int i=0; i<MAX_RSC; i++) {
|
|
|
|
no_rsc_ams[i] = false;
|
|
|
|
}
|
2010-12-01 18:04:18 +00:00
|
|
|
}
|
|
|
|
|
2010-09-24 20:02:42 +00:00
|
|
|
#ifdef SIM
|
|
|
|
RANDOM_PROCESS available;
|
|
|
|
int index;
|
|
|
|
int result_index;
|
|
|
|
double idle_time;
|
|
|
|
double idle_time_sumsq;
|
|
|
|
bool idle;
|
|
|
|
int max_infeasible_count;
|
2011-10-19 06:37:03 +00:00
|
|
|
bool no_apps;
|
2010-09-24 20:02:42 +00:00
|
|
|
// for DCF variants:
|
|
|
|
int completed_task_count;
|
|
|
|
double completions_ratio_mean;
|
|
|
|
double completions_ratio_s;
|
|
|
|
double completions_ratio_stdev;
|
|
|
|
double completions_required_stdevs;
|
|
|
|
PROJECT_RESULTS project_results;
|
|
|
|
void print_results(FILE*, SIM_RESULTS&);
|
|
|
|
void backoff();
|
|
|
|
void update_dcf_stats(RESULT*);
|
|
|
|
#endif
|
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];
|
2011-05-25 21:16:45 +00:00
|
|
|
bool non_cpu_intensive;
|
2002-04-30 22:22:54 +00:00
|
|
|
PROJECT* project;
|
2010-09-24 20:02:42 +00:00
|
|
|
#ifdef SIM
|
|
|
|
double latency_bound;
|
|
|
|
double fpops_est;
|
|
|
|
NORMAL_DIST fpops;
|
|
|
|
NORMAL_DIST checkpoint_period;
|
|
|
|
double working_set;
|
|
|
|
double weight;
|
2010-10-22 18:35:06 +00:00
|
|
|
bool ignore;
|
2010-09-27 20:34:47 +00:00
|
|
|
APP() {memset(this, 0, sizeof(APP));}
|
2010-09-24 20:02:42 +00:00
|
|
|
#endif
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse(XML_PARSER&);
|
2004-06-12 04:45:36 +00:00
|
|
|
int write(MIOFILE&);
|
2002-04-30 22:22:54 +00:00
|
|
|
};
|
|
|
|
|
2011-03-25 03:44:09 +00:00
|
|
|
struct GPU_USAGE {
|
|
|
|
int rsc_type;
|
|
|
|
double usage;
|
|
|
|
};
|
|
|
|
|
2002-05-17 22:33:57 +00:00
|
|
|
struct APP_VERSION {
|
|
|
|
char app_name[256];
|
|
|
|
int version_num;
|
2007-05-03 17:14:30 +00:00
|
|
|
char platform[256];
|
2008-03-27 18:25:29 +00:00
|
|
|
char plan_class[64];
|
2007-09-21 18:10:54 +00:00
|
|
|
char api_version[16];
|
2008-03-28 18:00:27 +00:00
|
|
|
double avg_ncpus;
|
|
|
|
double max_ncpus;
|
2011-03-25 03:44:09 +00:00
|
|
|
GPU_USAGE gpu_usage; // can only use 1 GPUtype
|
2009-12-11 22:45:59 +00:00
|
|
|
double gpu_ram;
|
2008-03-28 18:00:27 +00:00
|
|
|
double flops;
|
2008-10-04 23:44:24 +00:00
|
|
|
char cmdline[256];
|
2010-04-01 05:54:29 +00:00
|
|
|
// additional cmdline args
|
2011-08-03 18:14:45 +00:00
|
|
|
char file_prefix[256];
|
|
|
|
// prepend this to input/output file logical names
|
|
|
|
// (e.g. "share" for VM apps)
|
2011-12-26 04:56:36 +00:00
|
|
|
bool needs_network;
|
2008-03-28 18:00:27 +00:00
|
|
|
|
2002-05-17 22:33:57 +00:00
|
|
|
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;
|
2007-06-14 23:08:43 +00:00
|
|
|
char graphics_exec_path[512];
|
2010-04-07 05:54:20 +00:00
|
|
|
char graphics_exec_file[256];
|
2009-04-09 16:46:03 +00:00
|
|
|
double max_working_set_size;
|
|
|
|
// max working set of tasks using this app version.
|
2010-12-11 19:03:57 +00:00
|
|
|
// unstarted jobs using this app version are assumed
|
|
|
|
// to use this much RAM,
|
|
|
|
// so that we don't run a long sequence of jobs,
|
|
|
|
// each of which turns out not to fit in available RAM
|
2011-03-25 03:44:09 +00:00
|
|
|
bool missing_coproc;
|
2011-04-20 23:32:14 +00:00
|
|
|
double missing_coproc_usage;
|
2011-03-25 03:44:09 +00:00
|
|
|
char missing_coproc_name[256];
|
2011-06-17 19:16:07 +00:00
|
|
|
bool dont_throttle;
|
2010-05-13 20:18:27 +00:00
|
|
|
|
|
|
|
int index; // temp var for make_scheduler_request()
|
2010-11-01 16:53:41 +00:00
|
|
|
#ifdef SIM
|
|
|
|
bool dont_use;
|
|
|
|
#endif
|
2002-05-17 22:33:57 +00:00
|
|
|
|
2007-05-10 16:23:10 +00:00
|
|
|
APP_VERSION(){}
|
|
|
|
~APP_VERSION(){}
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse(XML_PARSER&);
|
2009-03-05 17:45:36 +00:00
|
|
|
int write(MIOFILE&, bool write_file_info = true);
|
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();
|
2007-09-21 18:10:54 +00:00
|
|
|
int api_major_version();
|
2011-06-12 20:58:43 +00:00
|
|
|
inline bool uses_coproc(int rt) {
|
|
|
|
return (gpu_usage.rsc_type == rt);
|
2009-08-19 18:41:47 +00:00
|
|
|
}
|
2010-03-05 21:13:53 +00:00
|
|
|
inline int rsc_type() {
|
2011-03-25 03:44:09 +00:00
|
|
|
return gpu_usage.rsc_type;
|
2010-03-05 21:13:53 +00:00
|
|
|
}
|
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;
|
2010-04-01 05:54:29 +00:00
|
|
|
// Deprecated, but need to keep around to let people revert
|
|
|
|
// to versions before multi-platform support
|
2004-12-26 02:55:31 +00:00
|
|
|
std::string command_line;
|
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;
|
|
|
|
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
|
|
|
|
2007-05-10 16:23:10 +00:00
|
|
|
WORKUNIT(){}
|
|
|
|
~WORKUNIT(){}
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse(XML_PARSER&);
|
2004-06-12 04:45:36 +00:00
|
|
|
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];
|
2009-06-30 20:22:54 +00:00
|
|
|
double received_time; // when we got this from server
|
2004-12-01 20:56:20 +00:00
|
|
|
double report_deadline;
|
2007-05-03 17:14:30 +00:00
|
|
|
int version_num; // identifies the app used
|
2008-03-27 18:25:29 +00:00
|
|
|
char plan_class[64];
|
2007-05-03 17:14:30 +00:00
|
|
|
char platform[256];
|
|
|
|
APP_VERSION* avp;
|
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;
|
2010-04-01 05:54:29 +00:00
|
|
|
// 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;
|
2010-04-01 05:54:29 +00:00
|
|
|
// time when ready_to_report was set
|
2003-09-23 23:19:41 +00:00
|
|
|
bool got_server_ack;
|
2010-04-01 05:54:29 +00:00
|
|
|
// we've received the ack for this result from the server
|
2002-08-05 00:29:34 +00:00
|
|
|
double final_cpu_time;
|
2009-03-11 22:01:38 +00:00
|
|
|
double final_elapsed_time;
|
2010-11-23 19:39:47 +00:00
|
|
|
#ifdef SIM
|
|
|
|
double peak_flop_count;
|
2011-10-17 20:46:06 +00:00
|
|
|
double sim_flops_left;
|
2010-11-23 19:39:47 +00:00
|
|
|
#endif
|
2008-10-04 23:44:24 +00:00
|
|
|
|
|
|
|
// the following are nonzero if reported by app
|
|
|
|
double fpops_per_cpu_sec;
|
|
|
|
double fpops_cumulative;
|
|
|
|
double intops_per_cpu_sec;
|
|
|
|
double intops_cumulative;
|
|
|
|
|
|
|
|
int _state;
|
2010-04-01 05:54:29 +00:00
|
|
|
// state of this result: see lib/result_state.h
|
2007-01-24 21:20:57 +00:00
|
|
|
inline int state() { return _state; }
|
|
|
|
void set_state(int, const char*);
|
2008-10-04 23:44:24 +00:00
|
|
|
int exit_status;
|
2010-04-01 05:54:29 +00:00
|
|
|
// return value from the application
|
2004-06-30 18:17:21 +00:00
|
|
|
std::string stderr_out;
|
2010-04-01 05:54:29 +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;
|
2009-10-12 16:28:17 +00:00
|
|
|
bool coproc_missing;
|
|
|
|
// a coproc needed by this job is missing
|
|
|
|
// (e.g. because user removed their GPU board).
|
2011-05-07 18:34:32 +00:00
|
|
|
bool report_immediately;
|
2011-11-04 08:15:04 +00:00
|
|
|
bool not_started; // temp for CPU sched
|
2003-07-03 00:48:43 +00:00
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
APP* app;
|
|
|
|
WORKUNIT* wup;
|
|
|
|
PROJECT* project;
|
|
|
|
|
2007-05-10 16:23:10 +00:00
|
|
|
RESULT(){}
|
|
|
|
~RESULT(){}
|
2002-07-05 05:33:40 +00:00
|
|
|
void clear();
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse_server(XML_PARSER&);
|
|
|
|
int parse_state(XML_PARSER&);
|
|
|
|
int parse_name(XML_PARSER&, 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);
|
2010-04-01 05:54:29 +00:00
|
|
|
// 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)
|
2007-04-13 04:22:20 +00:00
|
|
|
void append_log_record();
|
2006-01-27 19:50:43 +00:00
|
|
|
|
|
|
|
// stuff related to CPU scheduling
|
|
|
|
|
2011-11-04 08:15:04 +00:00
|
|
|
bool is_not_started();
|
2010-11-17 20:04:58 +00:00
|
|
|
double estimated_duration();
|
2008-12-02 03:58:32 +00:00
|
|
|
double estimated_duration_uncorrected();
|
2010-11-17 20:04:58 +00:00
|
|
|
double estimated_time_remaining();
|
2008-12-02 03:58:32 +00:00
|
|
|
inline double estimated_flops_remaining() {
|
2011-10-17 20:46:06 +00:00
|
|
|
#ifdef SIM
|
|
|
|
return sim_flops_left;
|
|
|
|
#else
|
2010-11-17 20:04:58 +00:00
|
|
|
return estimated_time_remaining()*avp->flops;
|
2011-10-17 20:46:06 +00:00
|
|
|
#endif
|
2008-12-02 03:58:32 +00:00
|
|
|
}
|
|
|
|
|
2009-02-26 17:12:55 +00:00
|
|
|
inline bool computing_done() {
|
|
|
|
if (state() >= RESULT_COMPUTE_ERROR) return true;
|
|
|
|
if (ready_to_report) return true;
|
|
|
|
return false;
|
|
|
|
}
|
2005-06-07 18:30:36 +00:00
|
|
|
bool runnable();
|
2010-04-01 05:54:29 +00:00
|
|
|
// downloaded, not finished, not suspended, project not suspended
|
2006-06-20 20:29:10 +00:00
|
|
|
bool nearly_runnable();
|
2010-04-01 05:54:29 +00:00
|
|
|
// downloading or downloaded,
|
|
|
|
// not finished, suspended, project not suspended
|
2006-09-06 21:58:12 +00:00
|
|
|
bool downloading();
|
2010-04-01 05:54:29 +00:00
|
|
|
// downloading, not downloaded, not suspended, project not suspended
|
2006-11-26 02:06:30 +00:00
|
|
|
bool some_download_stalled();
|
2010-04-01 05:54:29 +00:00
|
|
|
// some input or app file is downloading, and backed off
|
|
|
|
// i.e. it may be a long time before we can run this result
|
2009-02-01 04:37:19 +00:00
|
|
|
inline bool uses_coprocs() {
|
2011-03-25 03:44:09 +00:00
|
|
|
return (avp->gpu_usage.rsc_type != 0);
|
2008-09-25 01:04:53 +00:00
|
|
|
}
|
2010-10-15 20:16:00 +00:00
|
|
|
inline int resource_type() {
|
2011-03-25 03:44:09 +00:00
|
|
|
return avp->gpu_usage.rsc_type;
|
2010-10-15 20:16:00 +00:00
|
|
|
}
|
2011-05-25 21:16:45 +00:00
|
|
|
inline bool non_cpu_intensive() {
|
2011-06-17 19:16:07 +00:00
|
|
|
if (project->non_cpu_intensive) return true;
|
|
|
|
if (app->non_cpu_intensive) return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
inline bool dont_throttle() {
|
|
|
|
if (non_cpu_intensive()) return true;
|
|
|
|
if (avp->dont_throttle) return true;
|
|
|
|
return false;
|
2011-05-25 21:16:45 +00:00
|
|
|
}
|
2007-03-05 00:32:26 +00:00
|
|
|
|
|
|
|
// temporaries used in CLIENT_STATE::rr_simulation():
|
2008-12-02 03:58:32 +00:00
|
|
|
double rrsim_flops_left;
|
2006-01-27 19:50:43 +00:00
|
|
|
double rrsim_finish_delay;
|
2008-12-02 03:58:32 +00:00
|
|
|
double rrsim_flops;
|
2011-09-12 17:01:54 +00:00
|
|
|
bool rrsim_done;
|
2008-11-01 21:10:08 +00:00
|
|
|
|
2006-01-27 19:50:43 +00:00
|
|
|
bool already_selected;
|
2010-04-01 05:54:29 +00:00
|
|
|
// 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();
|
2010-04-01 05:54:29 +00:00
|
|
|
// report deadline - prefs.work_buf_min - time slice
|
2006-06-15 23:15:27 +00:00
|
|
|
bool rr_sim_misses_deadline;
|
2007-03-05 00:32:26 +00:00
|
|
|
|
2009-05-04 19:55:59 +00:00
|
|
|
// temporaries used in enforce_schedule():
|
|
|
|
bool unfinished_time_slice;
|
|
|
|
int seqno;
|
|
|
|
|
2007-03-05 00:32:26 +00:00
|
|
|
bool edf_scheduled;
|
2010-04-01 05:54:29 +00:00
|
|
|
// temporary used to tell GUI that this result is deadline-scheduled
|
2009-09-22 21:02:06 +00:00
|
|
|
|
|
|
|
int coproc_indices[MAX_COPROCS_PER_JOB];
|
|
|
|
// keep track of coprocessor reservations
|
2009-10-04 02:51:44 +00:00
|
|
|
char resources[256];
|
|
|
|
// textual description of resources used
|
2009-12-11 22:45:59 +00:00
|
|
|
double schedule_backoff;
|
|
|
|
// don't try to schedule until this time
|
2010-04-18 03:00:33 +00:00
|
|
|
// (wait for free GPU RAM)
|
2006-01-28 00:17:26 +00:00
|
|
|
};
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2010-04-01 05:54:29 +00:00
|
|
|
// represents an always/auto/never value, possibly temporarily overridden
|
2008-10-04 23:44:24 +00:00
|
|
|
|
2011-08-09 20:41:15 +00:00
|
|
|
struct RUN_MODE {
|
2006-11-10 17:55:22 +00:00
|
|
|
int perm_mode;
|
|
|
|
int temp_mode;
|
|
|
|
double temp_timeout;
|
2011-08-09 20:41:15 +00:00
|
|
|
RUN_MODE();
|
2006-11-10 17:55:22 +00:00
|
|
|
void set(int mode, double duration);
|
|
|
|
int get_perm();
|
|
|
|
int get_current();
|
2006-11-20 16:52:03 +00:00
|
|
|
double delay();
|
2006-11-10 17:55:22 +00:00
|
|
|
};
|
|
|
|
|
2010-04-01 05:54:29 +00:00
|
|
|
// a platform supported by the client.
|
2008-10-04 23:44:24 +00:00
|
|
|
|
2007-05-02 17:53:35 +00:00
|
|
|
class PLATFORM {
|
|
|
|
public:
|
|
|
|
std::string name;
|
|
|
|
};
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
#endif
|