Skip to content

Commit

Permalink
Bugfix: worker wouldn't detach from agent
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 3e52a2ec1b1d1b542db09bb3c65a10ca7ad4bdcd
  • Loading branch information
drew committed Feb 3, 2022
1 parent 1d49296 commit fb82d3b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/gretel_client/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import threading

from dataclasses import asdict, dataclass
from typing import Callable, Dict, Generic, Iterator, List, Optional
from typing import Callable, Dict, Generic, Iterator, Optional

from backports.cached_property import cached_property

from gretel_client.agents.drivers.driver import ComputeUnit, Driver
from gretel_client.agents.drivers.registry import get_driver
from gretel_client.agents.logger import configure_logging
from gretel_client.config import configure_custom_logger, get_session_config
from gretel_client.docker import CloudCreds, DataVolumeDef
from gretel_client.docker import CloudCreds
from gretel_client.projects import get_project
from gretel_client.rest.apis import JobsApi, ProjectsApi, UsersApi

Expand Down
6 changes: 5 additions & 1 deletion src/gretel_client/agents/drivers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ def schedule(self, job: Job) -> Container:
if job.cloud_creds:
volumes.append(job.cloud_creds.volume)
container_run = build_container(
image=job.container_image, params=job.params, env=job.env, volumes=volumes
image=job.container_image,
params=job.params,
env=job.env,
volumes=volumes,
detach=True,
)
container_run.start()
if job.log:
Expand Down
1 change: 1 addition & 0 deletions src/gretel_client/cli/connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def start(
params=params,
volumes=volumes,
env=env,
detach=True,
)

sc.register_cleanup(lambda: container.stop())
Expand Down
1 change: 1 addition & 0 deletions tests/gretel_client/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def test_does_construct_connector_container(
)
],
env={"GRETEL_API_KEY": sess.api_key, "GRETEL_ENDPOINT": sess.endpoint},
detach=True,
)

build_container.return_value.start.assert_called_once()
Expand Down

0 comments on commit fb82d3b

Please sign in to comment.