Skip to content

Commit

Permalink
Unit test to create Singularity runner config with docker-based MLCub…
Browse files Browse the repository at this point in the history
…e. (#331)
  • Loading branch information
sergey-serebryakov authored Aug 2, 2023
1 parent 1955fc9 commit a147108
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: mlcube-name
description: mlcube-description
authors:
- { name: "First Second" }

platform:
accelerator_count: 0

docker:
# Image name.
image: hasan7/mock-prep-sep:0.0.0
# Docker build context relative to $MLCUBE_ROOT.
build_context: "../project"
# Docker file name within docker build context, default is `Dockerfile`.
build_file: "Dockerfile"

tasks:
prepare:
parameters:
inputs:
data_path: vids_files/
labels_path: labels_files/
parameters_file: parameters.yaml
outputs:
output_path: data/
output_labels_path: labels/

sanity_check:
parameters:
inputs:
data_path: data/
labels_path: labels/
parameters_file: parameters.yaml
statistics:
parameters:
inputs:
data_path: data/
labels_path: labels/
parameters_file: parameters.yaml
outputs:
output_path:
type: file
default: statistics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"{IMAGE_DIRECTORY}", _IMAGE_DIRECTORY.as_posix()
)


_sync_workspace_fn: t.Optional[t.Callable] = None


Expand Down Expand Up @@ -141,3 +142,15 @@ def test_mlcube_custom_entrypoints(self):
SingularityRun(mlcube, task=None).configure()
SingularityRun(mlcube, task="ls").run()
SingularityRun(mlcube, task="free").run()

@unittest.skipUnless(client is not None, reason="No singularity available.")
def test_mlcube_no_singularity_section_config(self):
mlcube: t.Union[DictConfig, t.Dict] = MLCubeConfig.create_mlcube_config(
(Path(__file__).parent / "resources" / "docker_mlcube.yaml").as_posix(),
runner_config=Config.DEFAULT,
runner_cls=SingularityRun,
)
self.assertIsInstance(mlcube, DictConfig)

mlcube = OmegaConf.to_container(mlcube, resolve=True)
self.assertIsInstance(mlcube, dict)

0 comments on commit a147108

Please sign in to comment.