diff --git a/tools/create_work.cpp b/tools/create_work.cpp
index 84233e5860..c321abb6f7 100644
--- a/tools/create_work.cpp
+++ b/tools/create_work.cpp
@@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
+// Copyright (C) 2014 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
@@ -15,11 +15,9 @@
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see .
-// Create a workunit.
-// Input files must be in the download dir.
-// See the docs for a description of WU and result template files
-// This program must be run in the project's root directory
-//
+// Create workunit(s).
+// see http://boinc.berkeley.edu/trac/wiki/JobSubmission
+
#include "config.h"
#include
@@ -36,6 +34,7 @@
#include "filesys.h"
#include "sched_config.h"
#include "str_replace.h"
+#include "str_util.h"
#include "util.h"
#include "backend_lib.h"
@@ -66,6 +65,7 @@ void usage() {
" [ --rsc_fpops_bound x ]\n"
" [ --rsc_memory_bound x ]\n"
" [ --size_class n ]\n"
+ " [ --stdin ]\n"
" [ --target_host ID ]\n"
" [ --target_nresults n ]\n"
" [ --target_team ID ]\n"
@@ -77,7 +77,7 @@ void usage() {
exit(1);
}
-bool arg(const char** argv, int i, const char* name) {
+bool arg(char** argv, int i, const char* name) {
char buf[256];
sprintf(buf, "-%s", name);
if (!strcmp(argv[i], buf)) return true;
@@ -86,138 +86,175 @@ bool arg(const char** argv, int i, const char* name) {
return false;
}
-int main(int argc, const char** argv) {
- DB_APP app;
+struct JOB_DESC {
DB_WORKUNIT wu;
- int retval;
char wu_template[BLOB_SIZE];
- char wu_template_file[256], result_template_file[256], result_template_path[MAXPATHLEN];
- const char* command_line=NULL;
- const char** infiles = NULL;
- int i, ninfiles;
+ char result_template_file[256], result_template_path[MAXPATHLEN];
+ char** infiles;
+ char* command_line;
+ char additional_xml[256];
+ bool assign_flag;
+ bool assign_multi;
+ int assign_id;
+ int assign_type;
+ int ninfiles;
+
+ JOB_DESC() {
+ wu.clear();
+ infiles = NULL;
+ command_line = NULL;
+ assign_flag = false;
+ assign_multi = false;
+ strcpy(result_template_file, "");
+ strcpy(additional_xml, "");
+ assign_id = 0;
+ assign_type = ASSIGN_NONE;
+ ninfiles = 0;
+
+ // defaults (in case they're not in WU template)
+ //
+ wu.id = 0;
+ wu.min_quorum = 2;
+ wu.target_nresults = 2;
+ wu.max_error_results = 3;
+ wu.max_total_results = 10;
+ wu.max_success_results = 6;
+ wu.rsc_fpops_est = 3600e9;
+ wu.rsc_fpops_bound = 86400e9;
+ wu.rsc_memory_bound = 5e8;
+ wu.rsc_disk_bound = 1e9;
+ wu.rsc_bandwidth_bound = 0.0;
+ wu.delay_bound = 7*86400;
+
+ }
+ void create();
+ void parse_cmdline(int, char**);
+};
+
+// parse additional job-specific info when using --stdin
+//
+void JOB_DESC::parse_cmdline(int argc, char** argv) {
+ for (int i=0; i\n";
diff --git a/tools/stage_file b/tools/stage_file
index bedb1d0e06..a1f041050b 100755
--- a/tools/stage_file
+++ b/tools/stage_file
@@ -85,6 +85,7 @@ $dl_md5_path = "$dl_path.md5";
// compute the file's MD5
//
$md5 = md5_file($path);
+$file_size = filesize($path);
// if file is already in download dir, make sure it's the same
//
@@ -117,7 +118,7 @@ Please use a different file name.
// make MD5 file if needed
//
if (!file_exists($dl_md5_path)) {
- $x = $md5." ".filesize($path)."\n";
+ $x = $md5." ".$file_size."\n";
file_put_contents($dl_md5_path, $x);
}