[ARVADOS] updated: 65791e2f03eb843f3790af6ccd7ea668f3e78c84

git at public.curoverse.com git at public.curoverse.com
Fri May 30 10:21:19 EDT 2014


Summary of changes:
 sdk/python/arvados/commands/put.py | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

       via  65791e2f03eb843f3790af6ccd7ea668f3e78c84 (commit)
       via  7a55709cc7fdd72115ffd4302cc1f92a36ec35b9 (commit)
      from  cbd6078842b5b2893d5eded02ee14b1d47432754 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 65791e2f03eb843f3790af6ccd7ea668f3e78c84
Author: Brett Smith <brett at curoverse.com>
Date:   Fri May 30 10:21:59 2014 -0400

    2752: arv-put doesn't update the resume cache when aborted.
    
    It's appealing to try to save the latest state when we have the
    opportunity, but the problem is that we can't be sure that our
    CollectionWriter is in a consistent state when we get a signal or
    exception.  The previous code could potentially write inconsistent
    state, which would appear to resume successfully but PUT different
    data.  Instead rely exclusively on cache updates that are done from a
    known consistent state.

diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py
index d9e401d..3046154 100644
--- a/sdk/python/arvados/commands/put.py
+++ b/sdk/python/arvados/commands/put.py
@@ -325,6 +325,9 @@ def progress_writer(progress_func, outfile=sys.stderr):
         outfile.write(progress_func(bytes_written, bytes_expected))
     return write_progress
 
+def exit_signal_handler(sigcode, frame):
+    sys.exit(-sigcode)
+
 def main(arguments=None):
     ResumeCache.setup_user_cache()
     args = parse_arguments(arguments)
@@ -347,12 +350,9 @@ def main(arguments=None):
     writer = ArvPutCollectionWriter.from_cache(
         resume_cache, reporter, expected_bytes_for(args.paths))
 
-    def signal_handler(sigcode, frame):
-        writer.cache_state()
-        sys.exit(-sigcode)
     # Install our signal handler for each code in CAUGHT_SIGNALS, and save
     # the originals.
-    orig_signal_handlers = {sigcode: signal.signal(sigcode, signal_handler)
+    orig_signal_handlers = {sigcode: signal.signal(sigcode, exit_signal_handler)
                             for sigcode in CAUGHT_SIGNALS}
 
     if writer.bytes_written > 0:  # We're resuming a previous upload.
@@ -361,19 +361,16 @@ def main(arguments=None):
                 "         Use the --no-resume option to start over."])
         writer.report_progress()
 
-    try:
-        writer.do_queued_work()  # Do work resumed from cache.
-        for path in args.paths:  # Copy file data to Keep.
-            if os.path.isdir(path):
-                writer.write_directory_tree(
-                    path, max_manifest_depth=args.max_manifest_depth)
-            else:
-                writer.start_new_stream()
-                writer.write_file(path, args.filename or os.path.basename(path))
-        writer.finish_current_stream()
-    except Exception:
-        writer.cache_state()
-        raise
+    writer.do_queued_work()  # Do work resumed from cache.
+    for path in args.paths:  # Copy file data to Keep.
+        if os.path.isdir(path):
+            writer.write_directory_tree(
+                path, max_manifest_depth=args.max_manifest_depth)
+        else:
+            writer.start_new_stream()
+            writer.write_file(path, args.filename or os.path.basename(path))
+    writer.finish_current_stream()
+    writer.flush_data()  # Ensure we display a 100% result.
 
     if args.progress:  # Print newline to split stderr from stdout for humans.
         print >>sys.stderr

commit 7a55709cc7fdd72115ffd4302cc1f92a36ec35b9
Author: Brett Smith <brett at curoverse.com>
Date:   Fri May 30 09:59:39 2014 -0400

    2752: Wrap long arv-put resume message.

diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py
index c65bf90..d9e401d 100644
--- a/sdk/python/arvados/commands/put.py
+++ b/sdk/python/arvados/commands/put.py
@@ -356,7 +356,9 @@ def main(arguments=None):
                             for sigcode in CAUGHT_SIGNALS}
 
     if writer.bytes_written > 0:  # We're resuming a previous upload.
-        print >>sys.stderr, "arv-put: Resuming previous upload from last checkpoint.  Use the --no-resume option to start over."
+        print >>sys.stderr, "\n".join([
+                "arv-put: Resuming previous upload from last checkpoint.",
+                "         Use the --no-resume option to start over."])
         writer.report_progress()
 
     try:

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list