diff --git a/html/inc/sandbox.inc b/html/inc/sandbox.inc
index 620c8e4d5a0..6ec90b6d972 100644
--- a/html/inc/sandbox.inc
+++ b/html/inc/sandbox.inc
@@ -69,7 +69,7 @@ function sandbox_parse_info_file($user, $name) {
if ($info) {
return $info;
}
- [$size, $md5] = get_file_info("$dir/$name");
+ [$md5, $size] = get_file_info("$dir/$name");
write_info_file($info_path, $md5, $size);
return [$md5, $size];
}
diff --git a/html/user/buda.php b/html/user/buda.php
index 480542b7253..c5271ae0586 100644
--- a/html/user/buda.php
+++ b/html/user/buda.php
@@ -114,7 +114,7 @@ function variant_view() {
}
end_table();
show_button_small(
- "buda.php?action=variant_delete&app=$dir&variant=$variant",
+ "buda.php?action=variant_delete&app=$app&variant=$variant",
'Delete variant'
);
page_tail();
@@ -167,6 +167,7 @@ function copy_and_stage_file($user, $fname, $dir, $app, $variant) {
function variant_action($user) {
global $buda_root;
$variant = get_str('variant');
+ if (!$variant) $variant = 'cpu';
if (!is_valid_filename($variant)) die('bad arg');
$app = get_str('app');
if (!is_valid_filename($app)) die('bad arg');
@@ -300,7 +301,7 @@ function app_form() {
function app_action() {
global $buda_root;
$name = get_str('name');
- if (!is_valid_filename($name)) die('bad arg');
+ if (!is_valid_filename($name)) die("bad arg: $name");
$dir = "$buda_root/$name";
if (file_exists($dir)) {
error_page("App $name already exists.");
diff --git a/html/user/buda_submit.php b/html/user/buda_submit.php
index 3a56969952b..36aab6b9c4b 100644
--- a/html/user/buda_submit.php
+++ b/html/user/buda_submit.php
@@ -81,8 +81,8 @@ function unzip_batch_file($user, $batch_file) {
// Scan a batch dir.
// Check its validity:
-// - Top level can have only infiles (shared)
-// - Subdirs (job dirs) can have only remaining infiles and possibly cmdline
+// - optional dir 'shared_input_files' has shared input files
+// - other dirs (job dirs) can have only remaining infiles and possibly cmdline
//
// Return a structure describing its contents, and the md5/size of files
//
diff --git a/html/user/sandbox.php b/html/user/sandbox.php
index ad493866850..9fa6037b97e 100644
--- a/html/user/sandbox.php
+++ b/html/user/sandbox.php
@@ -41,7 +41,7 @@ function list_files($user, $notice) {
}
echo "
-
Upload files
+ Upload files from this computer
NOTE: if you upload text files from Windows,
they will be given CRLF line endings.
@@ -63,6 +63,15 @@ function list_files($user, $notice) {
form_input_textarea('Contents', 'contents');
form_submit('OK');
form_end();
+ echo "
+
+ Get web file
+ ";
+ form_start('sandbox.php', 'post');
+ form_input_hidden('action', 'get_file');
+ form_input_text('URL', 'url');
+ form_submit('OK');
+ form_end();
echo "
Sandbox contents
@@ -150,6 +159,19 @@ function add_file($user) {
list_files($user, $notice);
}
+function get_file($user) {
+ $dir = sandbox_dir($user);
+ $url = post_str('url');
+ $fname = basename($url);
+ $path = "$dir/$fname";
+ if (file_exists($path)) {
+ error_page("File $fname exists; delete it first.");
+ }
+ copy($url, $path);
+ $notice = "Fetched file from $url
";
+ list_files($user, $notice);
+}
+
// delete a sandbox file.
//
function delete_file($user) {
@@ -189,6 +211,7 @@ function view_file($user) {
case '': list_files($user,""); break;
case 'upload_file': upload_file($user); break;
case 'add_file': add_file($user); break;
+case 'get_file': get_file($user); break;
case 'delete_file': delete_file($user); break;
case 'download_file': download_file($user); break;
case 'view_file': view_file($user); break;
diff --git a/samples/docker_wrapper/docker_wrapper.cpp b/samples/docker_wrapper/docker_wrapper.cpp
index 2d304d28c82..0d60234f055 100644
--- a/samples/docker_wrapper/docker_wrapper.cpp
+++ b/samples/docker_wrapper/docker_wrapper.cpp
@@ -321,21 +321,20 @@ int container_op(const char *op) {
}
// Clean up at end of job.
-// Show log output if verbose;
+// Show log output.
// remove container and image
//
void cleanup() {
char cmd[1024];
vector out;
- if (verbose) {
- sprintf(cmd, "logs %s", container_name);
- docker_conn.command(cmd, out);
- fprintf(stderr, "container log:\n");
- for (string line : out) {
- fprintf(stderr, " %s\n", line.c_str());
- }
+ sprintf(cmd, "logs %s", container_name);
+ docker_conn.command(cmd, out);
+ fprintf(stderr, "stderr from container:\n");
+ for (string line : out) {
+ fprintf(stderr, "%s\n", line.c_str());
}
+ fprintf(stderr, "stderr end\n");
container_op("stop");
diff --git a/samples/docker_wrapper/test_buda/Dockerfile_worker_1 b/samples/docker_wrapper/test_buda/Dockerfile_worker_1
deleted file mode 100644
index d897eaff2b1..00000000000
--- a/samples/docker_wrapper/test_buda/Dockerfile_worker_1
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM debian
-WORKDIR /app
-CMD ./main_2.sh
diff --git a/samples/docker_wrapper/test_buda/Dockerfile_worker_2 b/samples/docker_wrapper/test_buda/Dockerfile_worker_2
new file mode 100644
index 00000000000..40503e3b86d
--- /dev/null
+++ b/samples/docker_wrapper/test_buda/Dockerfile_worker_2
@@ -0,0 +1,4 @@
+FROM debian
+WORKDIR /app
+ENV ARGS ""
+CMD ./main_3.sh ${ARGS}
diff --git a/samples/docker_wrapper/test_buda/main_2.sh b/samples/docker_wrapper/test_buda/main_2.sh
deleted file mode 100644
index f07fd7a2a69..00000000000
--- a/samples/docker_wrapper/test_buda/main_2.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/bash
-
-./worker_3_x86_64-pc-linux-gnu --nsecs 20 in out
diff --git a/samples/docker_wrapper/test_buda/main_3.sh b/samples/docker_wrapper/test_buda/main_3.sh
new file mode 100644
index 00000000000..b45f6a05459
--- /dev/null
+++ b/samples/docker_wrapper/test_buda/main_3.sh
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+./worker_4_x86_64-pc-linux-gnu $ARGS in out
diff --git a/samples/worker/Makefile b/samples/worker/Makefile
index 0eb83b22a7c..67d7ef252e7 100644
--- a/samples/worker/Makefile
+++ b/samples/worker/Makefile
@@ -1,4 +1,4 @@
-CXXFLAGS += -g
+#CXXFLAGS += -g
CXX ?= g++
ifdef ANDROID
@@ -20,8 +20,8 @@ clean: distclean
distclean:
rm -f $(PROGS) $(addsuffix .exe, $(PROGS)) *.o
-worker$(WORKER_RELEASE_SUFFIX): worker.o
- $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o worker$(WORKER_RELEASE_SUFFIX) worker.o
+worker$(WORKER_RELEASE_SUFFIX): worker.cpp
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o worker$(WORKER_RELEASE_SUFFIX) worker.cpp
install: all
diff --git a/samples/worker/worker.cpp b/samples/worker/worker.cpp
index 77f591d56f8..9af923bb487 100644
--- a/samples/worker/worker.cpp
+++ b/samples/worker/worker.cpp
@@ -47,59 +47,72 @@ static double do_a_giga_flop(int foo) {
return x;
}
-void copy_uc(FILE* fin, FILE* fout) {
- int c;
+int copy_uc(FILE* fin, FILE* fout) {
+ int c, n=0;
while (1) {
c = fgetc(fin);
if (c == EOF) break;
fputc(toupper(c), fout);
+ n++;
}
+ return n;
}
int main(int argc, char** argv) {
+ const char *infile=NULL, *outfile=NULL;
FILE* in=0, *out=0;
int i, nsecs = 0;
for (i=1; i