misc
This commit is contained in:
@@ -1,20 +1,20 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
import random
|
import random
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from scgenerator import io
|
||||||
|
from scgenerator.physics.simulate import (
|
||||||
|
SequencialSimulations,
|
||||||
|
resume_simulations,
|
||||||
|
run_simulation_sequence,
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ray
|
import ray
|
||||||
except ImportError:
|
except ImportError:
|
||||||
ray = None
|
ray = None
|
||||||
|
|
||||||
from scgenerator.physics.simulate import (
|
|
||||||
run_simulation_sequence,
|
|
||||||
resume_simulations,
|
|
||||||
SequencialSimulations,
|
|
||||||
)
|
|
||||||
from scgenerator import io
|
|
||||||
|
|
||||||
|
|
||||||
def create_parser():
|
def create_parser():
|
||||||
parser = argparse.ArgumentParser(description="scgenerator command", prog="scgenerator")
|
parser = argparse.ArgumentParser(description="scgenerator command", prog="scgenerator")
|
||||||
@@ -30,7 +30,7 @@ def create_parser():
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--start-ray",
|
"--start-ray",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="assume no ray instance has been started beforehand",
|
help="initialize ray (ray must be installed)",
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@@ -94,12 +94,11 @@ def prep_ray(args):
|
|||||||
try:
|
try:
|
||||||
init_str = ray.init(
|
init_str = ray.init(
|
||||||
address="auto",
|
address="auto",
|
||||||
# _node_ip_address=os.environ.get("ip_head", "127.0.0.1").split(":")[0],
|
|
||||||
_redis_password=os.environ.get("redis_password", "caco1234"),
|
_redis_password=os.environ.get("redis_password", "caco1234"),
|
||||||
)
|
)
|
||||||
print(init_str)
|
print(init_str)
|
||||||
except ConnectionError:
|
except ConnectionError as e:
|
||||||
pass
|
print(e)
|
||||||
return SequencialSimulations if args.no_ray else None
|
return SequencialSimulations if args.no_ray else None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,6 @@ def progress_worker(
|
|||||||
if raw == 0:
|
if raw == 0:
|
||||||
return
|
return
|
||||||
i, rel_pos = raw
|
i, rel_pos = raw
|
||||||
print(i)
|
|
||||||
pbars[i].update(rel_pos - pbars[i].n)
|
pbars[i].update(rel_pos - pbars[i].n)
|
||||||
pbars[0].update()
|
pbars[0].update()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user