mirror of https://github.com/BOINC/boinc.git
Server: add optional size_class parameter to count_unsent_results().
This lets you write work generators that maintain min levels of unsent jobs for each size class.
This commit is contained in:
parent
503b481548
commit
0d8a22e75c
|
@ -273,17 +273,18 @@ int count_workunits(int& n, const char* query) {
|
|||
return workunit.count(n, query);
|
||||
}
|
||||
|
||||
int count_unsent_results(int& n, int appid) {
|
||||
char buf[256];
|
||||
int count_unsent_results(int& n, int appid, int size_class) {
|
||||
char query[1024], buf[256];
|
||||
sprintf(query, "where server_state<=%d", RESULT_SERVER_STATE_UNSENT);
|
||||
if (appid) {
|
||||
sprintf(buf, "where server_state<=%d and appid=%d ",
|
||||
RESULT_SERVER_STATE_UNSENT, appid
|
||||
);
|
||||
} else {
|
||||
sprintf(buf, "where server_state<=%d", RESULT_SERVER_STATE_UNSENT);
|
||||
sprintf(buf, " and appid=%d", appid);
|
||||
strcat(query, buf);
|
||||
}
|
||||
return count_results(buf, n);
|
||||
|
||||
if (size_class >= 0) {
|
||||
sprintf(buf, " and size_class=%d", size_class);
|
||||
strcat(query, buf);
|
||||
}
|
||||
return count_results(query, n);
|
||||
}
|
||||
|
||||
bool is_arg(const char* x, const char* y) {
|
||||
|
|
|
@ -72,7 +72,7 @@ struct PERF_INFO {
|
|||
extern int mylockf(int fd);
|
||||
|
||||
extern int count_workunits(int&, const char* query);
|
||||
extern int count_unsent_results(int&, int appid);
|
||||
extern int count_unsent_results(int&, int appid, int size_class=-1);
|
||||
|
||||
// Return a value for host_app_version.app_version_id.
|
||||
// if the app version is anonymous platform,
|
||||
|
|
Loading…
Reference in New Issue