@@ -244,57 +244,61 @@ def build_file_dbs(gen_tier_path, outdir):
244
244
print (f"INFO: ...took { dt } " )
245
245
246
246
247
- file_db_config = {}
248
-
249
- if (
250
- os .getenv ("PRODENV" ) is not None
251
- and os .getenv ("PRODENV" ) in snakemake .params .filedb_path
252
- ):
253
- prodenv = as_ro (os .getenv ("PRODENV" ))
247
+ def fformat (tier ):
248
+ abs_path = patterns .get_pattern_tier (
249
+ snakemake .params .setup , tier , check_in_cycle = False
250
+ )
251
+ return str (abs_path ).replace (ut .get_tier_path (snakemake .params .setup , tier ), "" )
254
252
255
- def tdirs (tier ):
256
- return as_ro (ut .get_tier_path (snakemake .params .setup , tier )).replace (
257
- prodenv , ""
258
- )
259
253
260
- file_db_config ["data_dir" ] = "$PRODENV"
254
+ if snakemake .params .setup .get ("build_file_dbs" , True ):
255
+ file_db_config = {}
261
256
262
- else :
263
- print ("WARNING: $PRODENV not set, the FileDB will not be relocatable" )
257
+ if (
258
+ os .getenv ("PRODENV" ) is not None
259
+ and os .getenv ("PRODENV" ) in snakemake .params .filedb_path
260
+ ):
261
+ prodenv = as_ro (os .getenv ("PRODENV" ))
264
262
265
- def tdirs (tier ):
266
- return as_ro (ut .get_tier_path (snakemake .params .setup , tier ))
263
+ def tdirs (tier ):
264
+ return as_ro (ut .get_tier_path (snakemake .params .setup , tier )).replace (
265
+ prodenv , ""
266
+ )
267
267
268
- file_db_config ["data_dir" ] = "/ "
268
+ file_db_config ["data_dir" ] = "$PRODENV "
269
269
270
+ else :
271
+ print ("WARNING: $PRODENV not set, the FileDB will not be relocatable" )
270
272
271
- file_db_config ["tier_dirs" ] = {
272
- k : tdirs (k ) for k in snakemake .params .setup ["table_format" ]
273
- }
273
+ def tdirs (tier ):
274
+ return as_ro (ut .get_tier_path (snakemake .params .setup , tier ))
274
275
276
+ file_db_config ["data_dir" ] = "/"
275
277
276
- def fformat (tier ):
277
- abs_path = patterns .get_pattern_tier (
278
- snakemake .params .setup , tier , check_in_cycle = False
279
- )
280
- return str (abs_path ).replace (ut .get_tier_path (snakemake .params .setup , tier ), "" )
281
-
278
+ file_db_config ["tier_dirs" ] = {
279
+ k : tdirs (k ) for k in snakemake .params .setup ["table_format" ]
280
+ }
282
281
283
- file_db_config |= {
284
- "file_format" : {k : fformat (k ) for k in snakemake .params .setup ["table_format" ]},
285
- "table_format" : snakemake .params .setup ["table_format" ],
286
- }
282
+ file_db_config |= {
283
+ "file_format" : {k : fformat (k ) for k in snakemake .params .setup ["table_format" ]},
284
+ "table_format" : snakemake .params .setup ["table_format" ],
285
+ }
287
286
288
287
if snakemake .wildcards .tier != "daq" :
289
- print (f"INFO: ...building FileDBs with { snakemake .threads } threads" )
288
+ if snakemake .params .setup .get ("build_file_dbs" , True ):
289
+ print (f"INFO: ...building FileDBs with { snakemake .threads } threads" )
290
290
291
- Path (snakemake .params .filedb_path ).mkdir (parents = True , exist_ok = True )
291
+ Path (snakemake .params .filedb_path ).mkdir (parents = True , exist_ok = True )
292
292
293
- with (Path (snakemake .params .filedb_path ) / "file_db_config.json" ).open ("w" ) as f :
294
- json .dump (file_db_config , f , indent = 2 )
293
+ with (Path (snakemake .params .filedb_path ) / "file_db_config.json" ).open (
294
+ "w"
295
+ ) as f :
296
+ json .dump (file_db_config , f , indent = 2 )
295
297
296
- build_file_dbs (ut .tier_path (snakemake .params .setup ), snakemake .params .filedb_path )
297
- (Path (snakemake .params .filedb_path ) / "file_db_config.json" ).unlink ()
298
+ build_file_dbs (
299
+ ut .tier_path (snakemake .params .setup ), snakemake .params .filedb_path
300
+ )
301
+ (Path (snakemake .params .filedb_path ) / "file_db_config.json" ).unlink ()
298
302
299
303
build_valid_keys (
300
304
Path (ut .tmp_par_path (snakemake .params .setup )) / "*_db.json" ,
0 commit comments