@@ -2126,6 +2126,11 @@ def _fn_bundle(self, bundle_id):
2126
2126
"""Return the canonical name to store bundle information."""
2127
2127
return os .path .join (self .path , ".bundles" , bundle_id )
2128
2128
2129
+ @property
2130
+ def _bundle_prefix (self ):
2131
+ sep = getattr (self ._environment , "JOB_ID_SEPARATOR" , "/" )
2132
+ return f"{ self .__class__ .__name__ } { sep } bundle{ sep } "
2133
+
2129
2134
def _store_bundled (self , operations ):
2130
2135
"""Store operation-ids as part of a bundle and return bundle id.
2131
2136
@@ -2148,9 +2153,8 @@ def _store_bundled(self, operations):
2148
2153
"""
2149
2154
if len (operations ) == 1 :
2150
2155
return operations [0 ].id
2151
- sep = getattr (self ._environment , "JOB_ID_SEPARATOR" , "/" )
2152
2156
_id = sha1 ("." .join (op .id for op in operations ).encode ("utf-8" )).hexdigest ()
2153
- bundle_id = f" { self .__class__ . __name__ } { sep } bundle { sep } { _id } "
2157
+ bundle_id = self ._bundle_prefix + _id
2154
2158
fn_bundle = self ._fn_bundle (bundle_id )
2155
2159
os .makedirs (os .path .dirname (fn_bundle ), exist_ok = True )
2156
2160
with open (fn_bundle , "w" ) as file :
@@ -2160,10 +2164,9 @@ def _store_bundled(self, operations):
2160
2164
2161
2165
def _expand_bundled_jobs (self , scheduler_jobs ):
2162
2166
"""Expand jobs which were submitted as part of a bundle."""
2163
- sep = getattr (self ._environment , "JOB_ID_SEPARATOR" , "/" )
2164
- bundle_prefix = f"{ self } { sep } bundle{ sep } "
2165
2167
if scheduler_jobs is None :
2166
2168
return
2169
+ bundle_prefix = self ._bundle_prefix
2167
2170
for job in scheduler_jobs :
2168
2171
if job .name ().startswith (bundle_prefix ):
2169
2172
with open (self ._fn_bundle (job .name ())) as file :
0 commit comments