Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
legout committed Aug 22, 2024
1 parent 45f12d8 commit 408b393
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 180 deletions.
6 changes: 0 additions & 6 deletions examples/hello_world2/README.md

This file was deleted.

44 changes: 0 additions & 44 deletions examples/hello_world2/conf/pipeline.yml

This file was deleted.

95 changes: 0 additions & 95 deletions examples/hello_world2/conf/scheduler.yml

This file was deleted.

26 changes: 0 additions & 26 deletions examples/hello_world2/conf/tracker.yml

This file was deleted.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ keywords = [
name = "FlowerPower"
readme = "README.md"
requires-python = ">= 3.11"
version = "0.5.1.3"
version = "0.5.2"

[project.scripts]
flowerpower = "flowerpower.cli:app"
Expand Down Expand Up @@ -75,4 +75,5 @@ exclude = [
"src/flowerpower.egg-info",
"src/flowerpower/__pycache__",
"docker",
".gitignore",
]
17 changes: 9 additions & 8 deletions src/flowerpower/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def write(self) -> None:
with open(self._path, "w") as f:
f.write(
eval(f"{self.name.upper()}_TEMPLATE")
+ yaml.dump(unmunchify(self._cfg), sort_keys=False).replace("null", "")
+ yaml.dump(unmunchify(self._cfg), sort_keys=False).replace("null", "").replace("{}","")
)

def update(self, cfg: dict | Munch) -> None:
Expand Down Expand Up @@ -82,7 +82,7 @@ def __init__(self, base_dir: str | None = None) -> None:
super().__init__(self.name, base_dir)

self.load()
self._cfg = self._cfg or self.init_cfg
self._cfg = self._cfg or munchify(self.init_cfg)


class SchedulerConfig(BaseConfig):
Expand All @@ -98,24 +98,25 @@ def __init__(self, base_dir: str | None = None) -> None:
super().__init__(self.name, base_dir)

self.load()
self._cfg = self._cfg or self.init_cfg
self._cfg = self._cfg or munchify(self.init_cfg)


class PipelineConfig(BaseConfig):
name = "pipeline"
init_cfg = {
"run": {
"dev": {"inputs": None, "final_vars": None, "with_tracker": False},
"prod": {"inputs": None, "final_vars": None, "with_tracker": True},
},
"run": {},
#{
# "dev": {"inputs": None, "final_vars": None, "with_tracker": False},
# "prod": {"inputs": None, "final_vars": None, "with_tracker": True},
#},
"params": {},
}

def __init__(self, base_dir: str | None = None) -> None:
super().__init__(self.name, base_dir)

self.load()
self._cfg = self._cfg or self.init_cfg
self._cfg = self._cfg or munchify(self.init_cfg)

def _to_ht_params(self, d: dict, parent_dict: dict | None = None):
"""
Expand Down
5 changes: 5 additions & 0 deletions src/flowerpower/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,11 @@ def add(
)
logger.info(f"Created pipeline module {name}.py")

run = run or {
"dev": {"final_vars": [], "inputs": {}},
"prod": {"final_vars": [], "inputs": {}},
}

self.cfg.update({"run": {name: run}, "params": {name: params}}, name="pipeline")
logger.info(f"Updated pipeline configuration {self._conf_dir}/pipeline.yml")
self.cfg.update({"pipeline": {name: schedule}}, name="scheduler")
Expand Down

0 comments on commit 408b393

Please sign in to comment.