@@ -26,10 +26,7 @@ def define(cls, spec: CalcJobProcessSpec) -> None:
2626 spec .inputs ["metadata" ]["label" ].default = "FANS"
2727 ## Processing Power
2828 spec .inputs ["metadata" ]["options" ]["withmpi" ].default = True
29- spec .inputs ["metadata" ]["options" ]["resources" ].default = {
30- "num_machines" : 1 ,
31- "num_mpiprocs_per_machine" : 4
32- }
29+ spec .inputs ["metadata" ]["options" ]["resources" ].default = {"num_machines" : 1 , "num_mpiprocs_per_machine" : 4 }
3330 ## Filenames
3431 spec .inputs ["metadata" ]["options" ]["input_filename" ].default = "input.json"
3532 spec .inputs ["metadata" ]["options" ]["output_filename" ].default = "output.h5"
@@ -72,14 +69,16 @@ def prepare_for_submission(self, folder: Folder) -> CalcInfo:
7269 """Prepare the calculation for submission."""
7370 # Stashed Strategy:
7471 if self .options .stashed_microstructure :
75- ms_filepath : Path = Path (self .inputs .code .computer .get_workdir ()) / \
76- "stash/microstructures" / \
77- self .inputs .microstructure .file .filename
72+ ms_filepath : Path = (
73+ Path (self .inputs .code .computer .get_workdir ())
74+ / "stash/microstructures"
75+ / self .inputs .microstructure .file .filename
76+ )
7877 # if microstructure does not exist in stash, make it
7978 if not ms_filepath .is_file ():
8079 ms_filepath .parent .mkdir (parents = True , exist_ok = True )
81- with self .inputs .microstructure .file .open (mode = 'rb' ) as source :
82- with ms_filepath .open (mode = 'wb' ) as target :
80+ with self .inputs .microstructure .file .open (mode = "rb" ) as source :
81+ with ms_filepath .open (mode = "wb" ) as target :
8382 copyfileobj (source , target )
8483
8584 # input.json as dict
@@ -90,11 +89,11 @@ def prepare_for_submission(self, folder: Folder) -> CalcInfo:
9089 dump (input_dict , json , indent = 4 )
9190 # Fragmented Strategy:
9291 else :
93- datasetname : str = self .inputs .microstructure .datasetname .value
94- with folder .open ("microstructure.h5" ,"bw" ) as f_dest :
95- with h5File (f_dest ,"w" ) as h5_dest :
92+ datasetname : str = self .inputs .microstructure .datasetname .value
93+ with folder .open ("microstructure.h5" , "bw" ) as f_dest :
94+ with h5File (f_dest , "w" ) as h5_dest :
9695 with self .inputs .microstructure .file .open (mode = "rb" ) as f_src :
97- with h5File (f_src ,'r' ) as h5_src :
96+ with h5File (f_src , "r" ) as h5_src :
9897 h5_src .copy (datasetname , h5_dest , name = datasetname )
9998
10099 # input.json as dict
@@ -117,8 +116,6 @@ def prepare_for_submission(self, folder: Folder) -> CalcInfo:
117116 calcinfo .local_copy_list = []
118117 calcinfo .remote_copy_list = []
119118 calcinfo .retrieve_list = [codeinfo .stdout_name , codeinfo .stderr_name ]
120- calcinfo .retrieve_temporary_list = [
121- self .options .output_filename
122- ]
119+ calcinfo .retrieve_temporary_list = [self .options .output_filename ]
123120
124121 return calcinfo
0 commit comments