mlcube icon indicating copy to clipboard operation
mlcube copied to clipboard

Custom entry points.

Open sergey-serebryakov opened this issue 3 years ago • 1 comments

Currently, MLCube docker and singularity runners require that docker and singularity images define entry points that serve as dispatcher scripts for various tasks implemented in those MLCubes.

This PR introduces a new feature - custom entry points for MLCube tasks:

tasks:
  download:
    entrypoint: /workspace/download.py
    parameters:
      inputs:
        data_config: {type: file, default: data.yaml}
      outputs:
        data_dir: {type: directory, default: data}
        log_dir: {type: directory, default: logs}

Technical details

  • One MLCube can implement tasks with and without entry points. If for some task there's no custom entry point, a default image entry point must exist.
  • When tasks do not define entry points and default image entry points are used, the first positional argument is always a task name.
  • When tasks define entry points, no task name is provided to those entry points.
  • Docker runner runs MLCubes with run command. When custom entry point is defined, the MLCube docker runner will pass --entrypoint parameter to docker.
  • Singularity runner uses run command to run tasks without entry points, and exec command when custom entry points exist.

Unit tests for docker and singularity runners partially cover this new functionality using very simple MLCubes. More details are available in MLCube docker and singularity runners package descriptions (__init__.py files).

sergey-serebryakov avatar Aug 03 '22 21:08 sergey-serebryakov

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

github-actions[bot] avatar Aug 03 '22 21:08 github-actions[bot]