8654: Print uuid of uploaded docker image on stderr instead of stdout.
authorPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 30 Mar 2016 18:00:24 +0000 (14:00 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 30 Mar 2016 18:28:19 +0000 (14:28 -0400)
sdk/cwl/arvados_cwl/__init__.py
sdk/python/arvados/commands/keepdocker.py

index 74f36d9ab6b53e0a7522d318c95486caf1d82fea..3762536d5913095507afae7b3cc9ed3673be3501 100644 (file)
@@ -52,7 +52,7 @@ def arv_docker_get_image(api_client, dockerRequirement, pull_image, project_uuid
         if image_tag:
             args.append(image_tag)
         logger.info("Uploading Docker image %s", ":".join(args[1:]))
-        arvados.commands.keepdocker.main(args)
+        arvados.commands.keepdocker.main(args, stdout=sys.stderr)
 
     return dockerRequirement["dockerImageId"]
 
index e48a6d15472cc2c90cd4af7e35251b653aa87cce..f66554115306796b94a0bdaef6aa0a194e5fabe7 100644 (file)
@@ -283,15 +283,15 @@ def list_images_in_arv(api_client, num_retries, image_name=None, image_tag=None)
     return [(image['collection'], image) for image in images
             if image['collection'] in existing_coll_uuids]
 
-def main(arguments=None):
+def main(arguments=None, stdout=sys.stdout):
     args = arg_parser.parse_args(arguments)
     api = arvados.api('v1')
 
     if args.image is None or args.image == 'images':
-        fmt = "{:30}  {:10}  {:12}  {:29}  {:20}"
-        print fmt.format("REPOSITORY", "TAG", "IMAGE ID", "COLLECTION", "CREATED")
+        fmt = "{:30}  {:10}  {:12}  {:29}  {:20}\n"
+        stdout.write(fmt.format("REPOSITORY", "TAG", "IMAGE ID", "COLLECTION", "CREATED"))
         for i, j in list_images_in_arv(api, args.retries):
-            print(fmt.format(j["repo"], j["tag"], j["dockerhash"][0:12], i, j["timestamp"].strftime("%c")))
+            stdout.write(fmt.format(j["repo"], j["tag"], j["dockerhash"][0:12], i, j["timestamp"].strftime("%c")))
         sys.exit(0)
 
     # Pull the image if requested, unless the image is specified as a hash
@@ -375,7 +375,7 @@ def main(arguments=None):
                     make_link(api, args.retries, 'docker_image_repo+tag',
                               image_repo_tag, **link_base)
 
-                print(coll_uuid)
+                stdout.write(coll_uuid + "\n")
 
                 sys.exit(0)