section in config are allowed but optional
This commit is contained in:
@@ -88,6 +88,11 @@ def load_toml(path: os.PathLike):
|
|||||||
path = conform_toml_path(path)
|
path = conform_toml_path(path)
|
||||||
with open(path, mode="r") as file:
|
with open(path, mode="r") as file:
|
||||||
dico = toml.load(file)
|
dico = toml.load(file)
|
||||||
|
dico.setdefault("variable", {})
|
||||||
|
for key in {"simulation", "fiber", "gas", "pulse"} & dico.keys():
|
||||||
|
section = dico.pop(key, {})
|
||||||
|
dico["variable"].update(section.pop("variable", {}))
|
||||||
|
dico.update(section)
|
||||||
return dico
|
return dico
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -424,7 +424,6 @@ class Simulations:
|
|||||||
io.save_parameters(self.param_seq.config, self.sim_dir, file_name="initial_config.toml")
|
io.save_parameters(self.param_seq.config, self.sim_dir, file_name="initial_config.toml")
|
||||||
|
|
||||||
self.sim_jobs_per_node = 1
|
self.sim_jobs_per_node = 1
|
||||||
self.max_concurrent_jobs = np.inf
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def finished_and_complete(self):
|
def finished_and_complete(self):
|
||||||
@@ -434,9 +433,6 @@ class Simulations:
|
|||||||
except IncompleteDataFolderError:
|
except IncompleteDataFolderError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def limit_concurrent_jobs(self, max_concurrent_jobs):
|
|
||||||
self.max_concurrent_jobs = max_concurrent_jobs
|
|
||||||
|
|
||||||
def update(self, param_seq: initialize.ParamSequence):
|
def update(self, param_seq: initialize.ParamSequence):
|
||||||
self.param_seq = param_seq
|
self.param_seq = param_seq
|
||||||
|
|
||||||
@@ -656,8 +652,7 @@ class RaySimulations(Simulations, priority=2):
|
|||||||
def sim_jobs_total(self):
|
def sim_jobs_total(self):
|
||||||
if self.param_seq.config.worker_num is not None:
|
if self.param_seq.config.worker_num is not None:
|
||||||
return self.param_seq.config.worker_num
|
return self.param_seq.config.worker_num
|
||||||
tot_cpus = sum([node.get("Resources", {}).get("CPU", 0) for node in ray.nodes()])
|
tot_cpus = ray.cluster_resources().get("CPU", 1)
|
||||||
tot_cpus = min(tot_cpus, self.max_concurrent_jobs)
|
|
||||||
return int(min(self.param_seq.num_sim, tot_cpus))
|
return int(min(self.param_seq.num_sim, tot_cpus))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user