mirror of https://github.com/BOINC/boinc.git
- GUI RPC: add get_message_seqno() RPC. fixes #931
svn path=/trunk/boinc/; revision=18576
This commit is contained in:
parent
2b5795c4bc
commit
9ec90c409e
|
@ -6196,3 +6196,14 @@ Charlie 7 July 2009
|
|||
|
||||
mac_installer/
|
||||
PostInstall.cpp
|
||||
|
||||
David 7 July 2009
|
||||
- GUI RPC: add get_message_seqno() RPC. fixes #931
|
||||
|
||||
client/
|
||||
work_fetch.cpp
|
||||
boinc_cmd.cpp
|
||||
gui_rpc_server_ops.cpp
|
||||
lib/
|
||||
gui_rpc_client_ops.cpp
|
||||
gui_rpc_client.h
|
||||
|
|
|
@ -68,6 +68,7 @@ Commands:\n\
|
|||
--get_disk_usage show disk usage\n\
|
||||
--get_proxy_settings\n\
|
||||
--get_messages [ seqno ] show messages > seqno\n\
|
||||
--get_message_count show largest message seqno\n\
|
||||
--get_host_info\n\
|
||||
--version, -V show core client version\n\
|
||||
--result url result_name op job operation\n\
|
||||
|
@ -361,6 +362,12 @@ int main(int argc, char** argv) {
|
|||
if (pi.http_user_name.size()) pi.use_http_authentication = true;
|
||||
if (pi.socks_server_name.size()) pi.use_socks_proxy = true;
|
||||
retval = rpc.set_proxy_settings(pi);
|
||||
} else if (!strcmp(cmd, "--get_message_count")) {
|
||||
int seqno;
|
||||
retval = rpc.get_message_count(seqno);
|
||||
if (!retval) {
|
||||
printf("Greatest message sequence number: %d\n", seqno);
|
||||
}
|
||||
} else if (!strcmp(cmd, "--get_messages")) {
|
||||
int seqno;
|
||||
if (i == argc) {
|
||||
|
|
|
@ -405,6 +405,14 @@ static void handle_get_messages(char* buf, MIOFILE& fout) {
|
|||
fout.printf("</msgs>\n");
|
||||
}
|
||||
|
||||
static void handle_get_message_count(char*, MIOFILE& fout) {
|
||||
if (message_descs.size() == 0) {
|
||||
fout.printf("<seqno>0</seqno>\n");
|
||||
} else {
|
||||
fout.printf("<seqno>%d</seqno>\n", message_descs[0]->seqno);
|
||||
}
|
||||
}
|
||||
|
||||
// <retry_file_transfer>
|
||||
// <project_url>XXX</project_url>
|
||||
// <filename>XXX</filename>
|
||||
|
@ -1124,6 +1132,8 @@ int GUI_RPC_CONN::handle_rpc() {
|
|||
handle_get_disk_usage(mf);
|
||||
} else if (match_tag(request_msg, "<get_messages")) {
|
||||
handle_get_messages(request_msg, mf);
|
||||
} else if (match_tag(request_msg, "<get_message_count")) {
|
||||
handle_get_message_count(request_msg, mf);
|
||||
} else if (match_tag(request_msg, "<get_host_info")) {
|
||||
handle_get_host_info(request_msg, mf);
|
||||
} else if (match_tag(request_msg, "<get_statistics")) {
|
||||
|
|
|
@ -885,16 +885,26 @@ double RESULT::estimated_time_remaining(bool for_work_fetch) {
|
|||
return estimated_duration(for_work_fetch);
|
||||
}
|
||||
|
||||
// Returns the estimated CPU time to completion (in seconds) of this task.
|
||||
// Returns the estimated elapsed time to completion (in seconds) of this task.
|
||||
// Compute this as a weighted average of estimates based on
|
||||
// 1) the workunit's flops count
|
||||
// 2) the current reported CPU time and fraction done
|
||||
// 1) the workunit's flops count (static estimate)
|
||||
// 2) the current elapsed time and fraction done (dynamic estimate)
|
||||
//
|
||||
double ACTIVE_TASK::est_time_to_completion(bool for_work_fetch) {
|
||||
if (fraction_done >= 1) return 0;
|
||||
double wu_est = result->estimated_duration(for_work_fetch);
|
||||
if (fraction_done <= 0) return wu_est;
|
||||
double frac_est = (elapsed_time / fraction_done) - elapsed_time;
|
||||
#if 0
|
||||
// commenting this out for now - could cause big discontinuity
|
||||
//
|
||||
if (elapsed_time >= wu_est) {
|
||||
// if the job has already run longer than static estimate,
|
||||
// just use the dynamic estimate.
|
||||
//
|
||||
return frac_est;
|
||||
}
|
||||
#endif
|
||||
double fraction_left = 1-fraction_done;
|
||||
double wu_weight = fraction_left * fraction_left;
|
||||
double fd_weight = 1 - wu_weight;
|
||||
|
|
|
@ -615,6 +615,7 @@ public:
|
|||
int set_proxy_settings(GR_PROXY_INFO&);
|
||||
int get_proxy_settings(GR_PROXY_INFO&);
|
||||
int get_messages(int seqno, MESSAGES&);
|
||||
int get_message_count(int& seqno);
|
||||
int file_transfer_op(FILE_TRANSFER&, const char*);
|
||||
int result_op(RESULT&, const char*);
|
||||
int get_host_info(HOST_INFO&);
|
||||
|
|
|
@ -1717,6 +1717,25 @@ int RPC_CLIENT::get_proxy_settings(GR_PROXY_INFO& p) {
|
|||
return retval;
|
||||
}
|
||||
|
||||
int RPC_CLIENT::get_message_count(int& seqno) {
|
||||
int retval;
|
||||
SET_LOCALE sl;
|
||||
char buf[256];
|
||||
RPC rpc(this);
|
||||
|
||||
sprintf(buf,
|
||||
"<get_message_count/>\n"
|
||||
);
|
||||
retval = rpc.do_rpc(buf);
|
||||
if (retval) return retval;
|
||||
while (rpc.fin.fgets(buf, 256)) {
|
||||
if (parse_int(buf, "<seqno>", seqno)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
||||
int RPC_CLIENT::get_messages(int seqno, MESSAGES& msgs) {
|
||||
int retval;
|
||||
SET_LOCALE sl;
|
||||
|
|
Loading…
Reference in New Issue