@@ -114,46 +114,6 @@ def make_equi(confs,
114114 inter .make_input_file (ii , 'relaxation' , relax_param )
115115
116116
117- def worker (work_path ,
118- run_task ,
119- forward_common_files ,
120- forward_files ,
121- backward_files ,
122- mdata ,
123- inter_type ):
124- machine , resources , command , group_size = util .get_machine_info (mdata , inter_type )
125- disp = make_dispatcher (machine , resources , work_path , [run_task ], group_size )
126- print ("%s --> Runing... " % (work_path ))
127-
128- api_version = mdata .get ('api_version' , '0.9' )
129- if LooseVersion (api_version ) < LooseVersion ('1.0' ):
130- warnings .warn (f"the dpdispatcher will be updated to new version."
131- f"And the interface may be changed. Please check the documents for more details" )
132- disp .run_jobs (resources ,
133- command ,
134- work_path ,
135- [run_task ],
136- group_size ,
137- forward_common_files ,
138- forward_files ,
139- backward_files ,
140- outlog = 'outlog' ,
141- errlog = 'errlog' )
142- elif LooseVersion (api_version ) >= LooseVersion ('1.0' ):
143- submission = make_submission (
144- mdata_machine = machine ,
145- mdata_resources = resources ,
146- commands = [command ],
147- work_path = work_path ,
148- run_tasks = run_task ,
149- group_size = group_size ,
150- forward_common_files = forward_common_files ,
151- forward_files = forward_files ,
152- backward_files = backward_files ,
153- outlog = 'outlog' ,
154- errlog = 'errlog'
155- )
156- submission .run_submission ()
157117
158118def run_equi (confs ,
159119 inter_param ,
@@ -166,18 +126,16 @@ def run_equi(confs,
166126 conf_dirs .sort ()
167127
168128 processes = len (conf_dirs )
169- pool = Pool (processes = processes )
170- print ("Submit job via %d processes" % processes )
171129
172130 # generate a list of task names like mp-xxx/relaxation/relax_task
173131 # ...
174132 work_path_list = []
175133 for ii in conf_dirs :
176- work_path_list .append (os .path .abspath ( os . path . join (ii , 'relaxation' ) ))
134+ work_path_list .append (os .path .join (ii , 'relaxation' ))
177135 all_task = []
178136 for ii in work_path_list :
179137 all_task .append (os .path .join (ii , 'relax_task' ))
180-
138+ run_tasks = all_task
181139 inter_type = inter_param ['type' ]
182140 # vasp
183141 if inter_type == "vasp" :
@@ -186,41 +144,51 @@ def run_equi(confs,
186144 mdata = convert_mdata (mdata , ["model_devi" ])
187145 else :
188146 raise RuntimeError ("unknown task %s, something wrong" % inter_type )
189-
147+
190148 # dispatch the tasks
191149 # POSCAR here is useless
192150 virtual_calculator = make_calculator (inter_param , "POSCAR" )
193151 forward_files = virtual_calculator .forward_files ()
194152 forward_common_files = virtual_calculator .forward_common_files ()
195153 backward_files = virtual_calculator .backward_files ()
196154 # backward_files += logs
197- # ...
198- run_tasks = util .collect_task (all_task , inter_type )
199- if len (run_tasks ) == 0 :
200- return
201- else :
202- run_tasks = [os .path .basename (ii ) for ii in all_task ]
203- machine , resources , command , group_size = util .get_machine_info (mdata , inter_type )
204- print ('%d tasks will be submited ' % len (run_tasks ))
205- multiple_ret = []
206- for ii in range (len (work_path_list )):
207- work_path = work_path_list [ii ]
208-
209- ret = pool .apply_async (worker , (work_path ,
210- run_tasks [ii ],
211- forward_common_files ,
212- forward_files ,
213- backward_files ,
214- mdata ,
215- inter_type ,
216- ))
217- multiple_ret .append (ret )
218- pool .close ()
219- pool .join ()
220- for ii in range (len (multiple_ret )):
221- if not multiple_ret [ii ].successful ():
222- raise RuntimeError ("Task %d is not successful! work_path: %s " % (ii , work_path_list [ii ]))
223- print ('finished' )
155+ machine , resources , command , group_size = util .get_machine_info (mdata , inter_type )
156+ work_path = os .getcwd ()
157+ print ("%s --> Runing... " % (work_path ))
158+
159+ api_version = mdata .get ('api_version' , '0.9' )
160+ if LooseVersion (api_version ) < LooseVersion ('1.0' ):
161+ warnings .warn (f"the dpdispatcher will be updated to new version."
162+ f"And the interface may be changed. Please check the documents for more details" )
163+ disp = make_dispatcher (machine , resources , work_path , run_tasks , group_size )
164+ disp .run_jobs (resources ,
165+ command ,
166+ work_path ,
167+ run_tasks ,
168+ group_size ,
169+ forward_common_files ,
170+ forward_files ,
171+ backward_files ,
172+ outlog = 'outlog' ,
173+ errlog = 'errlog' )
174+ elif LooseVersion (api_version ) >= LooseVersion ('1.0' ):
175+
176+ submission = make_submission (
177+ mdata_machine = machine ,
178+ mdata_resources = resources ,
179+ commands = [command ],
180+ work_path = work_path ,
181+ run_tasks = run_tasks ,
182+ group_size = group_size ,
183+ forward_common_files = forward_common_files ,
184+ forward_files = forward_files ,
185+ backward_files = backward_files ,
186+ outlog = 'outlog' ,
187+ errlog = 'errlog'
188+ )
189+ submission .run_submission ()
190+
191+
224192
225193def post_equi (confs , inter_param ):
226194 # find all POSCARs and their name like mp-xxx
0 commit comments