[ARVADOS] updated: 677eebc84a20221287c22b196dd81cf6ddb22fe1

git at public.curoverse.com git at public.curoverse.com
Tue Sep 16 13:23:26 EDT 2014


Summary of changes:
 sdk/python/arvados/commands/copy.py | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

       via  677eebc84a20221287c22b196dd81cf6ddb22fe1 (commit)
      from  04a4fa5843c3511260a750065cf79203ae1663ee (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 677eebc84a20221287c22b196dd81cf6ddb22fe1
Author: Tim Pierce <twp at curoverse.com>
Date:   Tue Sep 16 13:21:29 2014 -0400

    3699: update --src, --dst, --dst-git-repo args
    
    Per code review:
    
    * Use mandatory --src and --dst flags to specify source and destination
      Arvados. Each one can specify either a pathname to a config file or a
      bareword which identifies a file in
      $HOME/.arvados/config/instance.conf.
    
    * --dst-git-repo is only required when copying a pipeline recursively;
        not for non-recursive copies or collections.

diff --git a/sdk/python/arvados/commands/copy.py b/sdk/python/arvados/commands/copy.py
index 67fce1c..88438c8 100755
--- a/sdk/python/arvados/commands/copy.py
+++ b/sdk/python/arvados/commands/copy.py
@@ -38,6 +38,12 @@ def main():
         description='Copy a pipeline instance from one Arvados instance to another.')
 
     parser.add_argument(
+        '--src', dest='source_arvados', required=True,
+        help='The name of the source Arvados instance.')
+    parser.add_argument(
+        '--dst', dest='destination_arvados', required=True,
+        help='The name of the destination Arvados instance.')
+    parser.add_argument(
         '--recursive', dest='recursive', action='store_true',
         help='Recursively copy any dependencies for this object. (default)')
     parser.add_argument(
@@ -45,20 +51,13 @@ def main():
         help='Do not copy any dependencies. NOTE: if this option is given, the copied object will need to be updated manually in order to be functional.')
     parser.add_argument(
         '--dst-git-repo', dest='dst_git_repo',
-        required=True,
-        help='The name of the destination git repository.')
+        help='The name of the destination git repository. Required when copying a pipeline recursively.')
     parser.add_argument(
         '--project_uuid', dest='project_uuid',
         help='The UUID of the project at the destination to which the pipeline should be copied.')
     parser.add_argument(
         'object_uuid',
         help='The UUID of the object to be copied.')
-    parser.add_argument(
-        'source_arvados',
-        help='The name of the source Arvados instance.')
-    parser.add_argument(
-        'destination_arvados',
-        help='The name of the destination Arvados instance.')
     parser.set_defaults(recursive=True)
 
     args = parser.parse_args()
@@ -98,13 +97,21 @@ def main():
 # api_for_instance(instance_name)
 #
 #     Creates an API client for the Arvados instance identified by
-#     instance_name.  Credentials must be stored in
+#     instance_name.
+#
+#     If instance_name contains a slash, it is presumed to be a path
+#     (either local or absolute) to a file with Arvados configuration
+#     settings.
+#
+#     Otherwise, it is presumed to be the name of a file in
 #     $HOME/.config/arvados/instance_name.conf
 #
 def api_for_instance(instance_name):
     if '/' in instance_name:
-        abort('illegal instance name {}'.format(instance_name))
-    config_file = os.path.join(os.environ['HOME'], '.config', 'arvados', "{}.conf".format(instance_name))
+        config_file = instance_name
+    else:
+        config_file = os.path.join(os.environ['HOME'], '.config', 'arvados', "{}.conf".format(instance_name))
+
     try:
         cfg = arvados.config.load(config_file)
     except (IOError, OSError) as e:
@@ -151,6 +158,8 @@ def copy_pipeline_instance(pi_uuid, src, dst, dst_git_repo, dst_project=None, re
     pi = src.pipeline_instances().get(uuid=pi_uuid).execute()
 
     if recursive:
+        if not dst_git_repo:
+            abort('--dst-git-repo is required when copying a pipeline recursively.')
         # Copy the pipeline template and save the copied template.
         if pi.get('pipeline_template_uuid', None):
             pt = copy_pipeline_template(pi['pipeline_template_uuid'],
@@ -202,6 +211,8 @@ def copy_pipeline_template(pt_uuid, src, dst, dst_git_repo, recursive=True):
     pt = src.pipeline_templates().get(uuid=pt_uuid).execute()
 
     if recursive:
+        if not dst_git_repo:
+            abort('--dst-git-repo is required when copying a pipeline recursively.')
         # Copy input collections, docker images and git repos.
         pt = copy_collections(pt, src, dst)
         copy_git_repos(pt, src, dst, dst_git_repo)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list