Skip to content

Commit

Permalink
Refactor config handling with pydantic (cisco-open#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkurija1 authored and myungjin committed Mar 3, 2023
1 parent 949464d commit 781f0ca
Show file tree
Hide file tree
Showing 24 changed files with 317 additions and 471 deletions.
8 changes: 4 additions & 4 deletions lib/python/flame/channel_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ async def inner(q: asyncio.Queue) -> None:
coro = self._backend_eventq_task(q)
_ = asyncio.create_task(coro)

if self._config.channelConfigs is None:
if not self._config.channel_configs.backends:
self._backend = backend_provider.get(self._config.backend)
broker = self._config.brokers.sort_to_host[self._config.backend]
self._backend.configure(broker, self._job_id, self._task_id)
_ = run_async(inner(self._backend.eventq()), self._backend.loop())
return

# if there are per-channel configs
for k, v in self._config.channelConfigs.backends.items():
channel_brokers = self._config.channelConfigs.channel_brokers
for k, v in self._config.channel_configs.backends.items():
channel_brokers = self._config.channel_configs.channel_brokers
broker = channel_brokers[k].sort_to_host[v]
backend = backend_provider.get(v)
backend.configure(broker, self._job_id, self._task_id)
Expand Down Expand Up @@ -145,7 +145,7 @@ def join(self, name: str) -> bool:
me = channel_config.pair[1]
other = channel_config.pair[0]

groupby = channel_config.groupby.groupable_value(self._config.realm)
groupby = channel_config.group_by.groupable_value(self._config.realm)

selector = selector_provider.get(self._config.selector.sort,
**self._config.selector.kwargs)
Expand Down
2 changes: 1 addition & 1 deletion lib/python/flame/common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def install_package(package: str) -> bool:
def mlflow_runname(config: Config) -> str:
groupby_value = ""
for v in config.channels.values():
for val in v.groupby.value:
for val in v.group_by.value:
if val in config.realm:
groupby_value = groupby_value + val + "-"

Expand Down
Loading

0 comments on commit 781f0ca

Please sign in to comment.