19
19
20
20
import glob
21
21
import os
22
+ import traceback
22
23
import uuid
23
24
from collections import defaultdict
24
25
from functools import cmp_to_key
@@ -58,10 +59,10 @@ def migrate(migration_context):
58
59
"""Migration function."""
59
60
if MigrationType .WORKFLOWS not in migration_context .options .type :
60
61
return
61
- _migrate_old_workflows (migration_context .client )
62
+ _migrate_old_workflows (client = migration_context .client , strict = migration_context . options . strict )
62
63
63
64
64
- def _migrate_old_workflows (client ):
65
+ def _migrate_old_workflows (client , strict ):
65
66
"""Migrates old cwl workflows to new jsonld format."""
66
67
67
68
def sort_cwl_commits (e1 , e2 ):
@@ -86,17 +87,25 @@ def sort_cwl_commits(e1, e2):
86
87
communication .echo (f"Processing commit { n } /{ len (cwl_paths )} " , end = "\r " )
87
88
88
89
cwl_file , commit = element
89
- if not Path (cwl_file ).exists ():
90
- continue
91
- path = _migrate_cwl (client , cwl_file , commit )
92
- os .remove (cwl_file )
93
-
94
- client .repository .add (cwl_file , path )
95
90
96
- if client .repository .is_dirty ():
97
- commit_msg = "renku migrate: committing migrated workflow"
98
- committer = Actor (name = f"renku { __version__ } " , email = version_url )
99
- client .repository .commit (commit_msg , committer = committer , no_verify = True )
91
+ try :
92
+ if not Path (cwl_file ).exists ():
93
+ continue
94
+
95
+ path = _migrate_cwl (client , cwl_file , commit )
96
+ os .remove (cwl_file )
97
+
98
+ client .repository .add (cwl_file , path )
99
+
100
+ if client .repository .is_dirty ():
101
+ commit_msg = "renku migrate: committing migrated workflow"
102
+ committer = Actor (name = f"renku { __version__ } " , email = version_url )
103
+ client .repository .commit (commit_msg , committer = committer , no_verify = True )
104
+ except Exception :
105
+ if strict :
106
+ raise
107
+ communication .echo ("" )
108
+ communication .warn (f"Cannot process commit '{ commit .hexsha } ' - Exception: { traceback .format_exc ()} " )
100
109
101
110
102
111
def _migrate_cwl (client , path , commit ):
0 commit comments