VBOX: Partial commit for completion trigger files (David taking over)

This commit is contained in:
Rom Walton 2014-07-01 15:19:17 -04:00
parent eea6472331
commit f1981368f8
2 changed files with 26 additions and 0 deletions

View File

@ -141,6 +141,7 @@ public:
// minimum time between checkpoints // minimum time between checkpoints
std::vector<std::string> copy_to_shared; std::vector<std::string> copy_to_shared;
std::vector<std::string> trickle_trigger_files; std::vector<std::string> trickle_trigger_files;
std::vector<std::string> completion_trigger_files;
/////////// END VBOX_JOB.XML ITEMS ////////////// /////////// END VBOX_JOB.XML ITEMS //////////////

View File

@ -175,6 +175,10 @@ int parse_job_file(VBOX_VM& vm) {
vm.trickle_trigger_files.push_back(str); vm.trickle_trigger_files.push_back(str);
continue; continue;
} }
else if (xp.parse_string("completion_trigger_file", str)) {
vm.completion_trigger_files.push_back(str);
continue;
}
fprintf(stderr, "%s parse_job_file(): unexpected tag %s\n", fprintf(stderr, "%s parse_job_file(): unexpected tag %s\n",
vboxwrapper_msg_prefix(buf, sizeof(buf)), xp.parsed_tag vboxwrapper_msg_prefix(buf, sizeof(buf)), xp.parsed_tag
); );
@ -397,6 +401,27 @@ void VBOX_VM::check_trickle_triggers() {
} }
} }
// check for trickle trigger files, and send trickles if find them.
//
void VBOX_VM::check_trickle_triggers() {
char filename[256], path[MAXPATHLEN], buf[256];
for (unsigned int i=0; i<trickle_trigger_files.size(); i++) {
strcpy(filename, trickle_trigger_files[i].c_str());
sprintf(path, "shared/%s", filename);
if (!boinc_file_exists(path)) continue;
string text;
int retval = read_file_string(path, text);
if (retval) {
fprintf(stderr,
"%s can't read trickle trigger file %s\n",
vboxwrapper_msg_prefix(buf, sizeof(buf)), filename
);
}
boinc_send_trickle_up(filename, const_cast<char*>(text.c_str()));
boinc_delete_file(path);
}
}
int main(int argc, char** argv) { int main(int argc, char** argv) {
int retval; int retval;
int loop_iteration = 0; int loop_iteration = 0;