Skip to content

Commit

Permalink
fix: add deprecated func
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyazat committed Apr 4, 2023
1 parent 20f2758 commit c036c0d
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions deeppavlov_dreamtools/distconfigs/assistant_dists.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,76 @@ def from_dist(
def components(self):
return self.pipeline.components

def _create_dist(
self,
name: str,
dream_root: Union[str, Path],
service_names: Optional[list] = None,
pipeline_conf: bool = True,
compose_override: bool = True,
compose_dev: bool = True,
compose_proxy: bool = True,
compose_local: bool = True,
):
"""
!!!
DEPRECATED. FOR TEST ONLY
!!!
Creates Dream distribution inherited from another distribution.
The new distribution only has services included in ``service_names``.
Args:
name: name of new Dream distribution
dream_root: path to Dream root directory
service_names: list of services to be included in new distribution
pipeline_conf: load `pipeline_conf.json` inside ``path``
compose_override: load `docker-compose.override.yml` inside ``path``
compose_dev: load `dev.yml` inside ``path``
compose_proxy: load `proxy.yml` inside ``path``
compose_local: load `local.yml` inside ``path``
Returns:
instance of DreamDist
"""
new_compose_override = None
new_compose_dev = None
new_compose_proxy = None
new_compose_local = None

all_names, new_pipeline_conf = self.pipeline_conf.filter_services(service_names)
all_names += const.MANDATORY_SERVICES

if compose_override:
_, new_compose_override = self.compose_override.filter_services(all_names)

new_agent_command = re.sub(
f"assistant_dists/{self.name}/pipeline_conf.json",
f"assistant_dists/{name}/pipeline_conf.json",
new_compose_override.config.services["agent"].command,
)
new_compose_override.config.services["agent"].command = new_agent_command

new_compose_override.config.services["agent"].environment["WAIT_HOSTS"] = ""
if compose_dev:
_, new_compose_dev = self.compose_dev.filter_services(all_names)
if compose_proxy:
_, new_compose_proxy = self.compose_proxy.filter_services(all_names)
if compose_local:
_, new_compose_local = self.compose_local.filter_services(all_names)

pipeline = AssistantDist.from_name("dream", dream_root).pipeline

return AssistantDist(
self.resolve_dist_path(name, dream_root),
name,
dream_root,
pipeline,
new_pipeline_conf,
new_compose_override,
new_compose_dev,
new_compose_proxy,
new_compose_local,
)

def clone(
self,
name: str,
Expand Down

0 comments on commit c036c0d

Please sign in to comment.