run_dir fn
This commit is contained in:
parent
22e93da91f
commit
44d6534b5e
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "jo3util"
|
name = "jo3util"
|
||||||
version = "0.0.10"
|
version = "0.0.13"
|
||||||
description = ""
|
description = ""
|
||||||
dependencies = []
|
dependencies = []
|
||||||
dynamic = ["readme"]
|
dynamic = ["readme"]
|
||||||
|
|
14
src/root.py
14
src/root.py
|
@ -81,12 +81,10 @@ def root_file():
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
def run_dir(obj, subdir=Path("run")):
|
def run_dir(obj, root=Path(os.path.abspath("./run"))):
|
||||||
run_id: str = json.dumps(obj, default=lambda x: vars(x))
|
run_id: str = json.dumps(
|
||||||
|
obj,
|
||||||
|
default=lambda x: vars(x) if hasattr(x, "__dict__") else str(x)
|
||||||
|
)
|
||||||
run_id: str = hash_string(run_id)
|
run_id: str = hash_string(run_id)
|
||||||
|
return root / run_id
|
||||||
path = root_dir()
|
|
||||||
if subdir:
|
|
||||||
path /= subdir
|
|
||||||
path /= run_id
|
|
||||||
return path
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user