Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add early error message if docker is missing #113

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/soopervisor/airflow/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def _export(cfg, env_name, mode, until, skip_tests, ignore_git,
"""
with Commander(workspace=env_name,
templates_path=('soopervisor', 'assets')) as e:
commons.docker.validate_installation(e)

tasks, args = commons.load_tasks(cmdr=e,
name=env_name,
mode=mode,
Expand Down
1 change: 1 addition & 0 deletions src/soopervisor/argo/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def _export(cfg, env_name, mode, until, skip_tests, ignore_git,

with Commander(workspace=env_name,
templates_path=('soopervisor', 'assets')) as cmdr:
docker.validate_installation(cmdr)

tasks, args = commons.load_tasks(cmdr=cmdr,
name=env_name,
Expand Down
2 changes: 2 additions & 0 deletions src/soopervisor/aws/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ def _export(cls, cfg, env_name, mode, until, skip_tests, ignore_git,
lazy_import):
with Commander(workspace=env_name,
templates_path=('soopervisor', 'assets')) as cmdr:
docker.validate_installation(cmdr)

tasks, cli_args = commons.load_tasks(cmdr=cmdr,
name=env_name,
mode=mode,
Expand Down
17 changes: 17 additions & 0 deletions src/soopervisor/commons/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@ def modify_wildcard(entity):
return entity.replace("*", "ploomber")


def validate_installation(cmdr):
""" valdiate if docker is installed.

Paramemters
-----------
cmdr : Commander
Commander instance
"""

cmdr.run(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the user might now have awk installed, so this will fail. an easier way to check this is via shutil.which("docker")

'docker --version | awk \'NR==1{print $1}\'',
capture_output=True,
expected_output="Docker",
error_message="Did you install Docker?",
)


def get_dependencies():
"""
Fetch all dependency files and corresponding lock files
Expand Down
2 changes: 2 additions & 0 deletions src/soopervisor/kubeflow/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def _export(cfg, env_name, mode, until, skip_tests, ignore_git,
"""
with Commander(workspace=env_name,
templates_path=('soopervisor', 'assets')) as e:
commons.docker.validate_installation(e)

tasks, args = commons.load_tasks(cmdr=e, name=env_name, mode=mode)
dag, relative_path = commons.load_dag(cmdr=e,
name=env_name,
Expand Down