[arvados] updated: 2.6.0-82-g175ed47a8

git repository hosting git at public.arvados.org
Mon May 1 15:44:30 UTC 2023


Summary of changes:
 sdk/cwl/arvados_cwl/arvworkflow.py | 29 ++++++++---------------------
 sdk/cwl/arvados_cwl/util.py        | 15 +++++++++++++++
 sdk/cwl/tests/test_util.py         | 18 +++++++++++++++++-
 3 files changed, 40 insertions(+), 22 deletions(-)

       via  175ed47a8e498829e4227db72f85a6263c18f6c4 (commit)
       via  b3a65752c17598272235b67cccd3c9845327f525 (commit)
       via  7ac1e7337dca972ce93d04e5eccb6f4de9aed141 (commit)
      from  8bab6ec992cde137b14023bf92401dde9035cb5c (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 175ed47a8e498829e4227db72f85a6263c18f6c4
Merge: 8bab6ec99 b3a65752c
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Mon May 1 11:44:16 2023 -0400

    Merge branch '20462-workflow-prefix' refs #20462
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>


commit b3a65752c17598272235b67cccd3c9845327f525
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Mon May 1 11:42:29 2023 -0400

    20462: Move to util & use Brett's implementation
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/sdk/cwl/arvados_cwl/arvworkflow.py b/sdk/cwl/arvados_cwl/arvworkflow.py
index bd32e9f81..43d23e9b9 100644
--- a/sdk/cwl/arvados_cwl/arvworkflow.py
+++ b/sdk/cwl/arvados_cwl/arvworkflow.py
@@ -41,6 +41,7 @@ from .runner import (upload_dependencies, packed_workflow, upload_workflow_colle
 from .pathmapper import ArvPathMapper, trim_listing
 from .arvtool import ArvadosCommandTool, set_cluster_target
 from ._version import __version__
+from .util import common_prefix
 
 from .perf import Perf
 
@@ -248,32 +249,6 @@ def drop_ids(d):
             drop_ids(d[field])
 
 
-def common_prefix(firstfile, all_files):
-    n = 0
-    allmatch = True
-    if not firstfile:
-        return ""
-
-    while allmatch and n < len(firstfile)-1:
-        n += 1
-        for f in all_files:
-            if len(f)-1 < n:
-                n -= 1
-                allmatch = False
-                break
-            if f[n] != firstfile[n]:
-                allmatch = False
-                break
-
-    while n > 0 and firstfile[n] != "/":
-        n -= 1
-
-    if firstfile[n] == "/":
-        n += 1
-
-    return firstfile[:n]
-
-
 def upload_workflow(arvRunner, tool, job_order, project_uuid,
                         runtimeContext,
                         uuid=None,
diff --git a/sdk/cwl/arvados_cwl/util.py b/sdk/cwl/arvados_cwl/util.py
index a0c34ea52..299f854ec 100644
--- a/sdk/cwl/arvados_cwl/util.py
+++ b/sdk/cwl/arvados_cwl/util.py
@@ -34,3 +34,18 @@ def get_current_container(api, num_retries=0, logger=None):
             raise e
 
     return current_container
+
+
+def common_prefix(firstfile, all_files):
+    common_parts = firstfile.split('/')
+    common_parts[-1] = ''
+    for f in all_files:
+        f_parts = f.split('/')
+        for index, (a, b) in enumerate(zip(common_parts, f_parts)):
+            if a != b:
+                common_parts = common_parts[:index + 1]
+                common_parts[-1] = ''
+                break
+        if not any(common_parts):
+            break
+    return '/'.join(common_parts)
diff --git a/sdk/cwl/tests/test_util.py b/sdk/cwl/tests/test_util.py
index 183e0fcc6..bf3d6fe0e 100644
--- a/sdk/cwl/tests/test_util.py
+++ b/sdk/cwl/tests/test_util.py
@@ -11,7 +11,7 @@ import httplib2
 
 from arvados_cwl.util import *
 from arvados.errors import ApiError
-from arvados_cwl.arvworkflow import common_prefix
+from arvados_cwl.util import common_prefix
 
 class MockDateTime(datetime.datetime):
     @classmethod

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list