Skip to content

Overview ​

In this section, we will explain what is a module and how you can deploy a module.

What is a Module? ​

Modules turn your Python scripts into reusable tools. A module requires a main entry script, its compute environment, its Python version and dependencies, its inputs, and its outputs.

The source code for your module can be uploaded directly or sourced from a Git repository. Once deployed, modules can be used by other users or agents to run jobs. This lets you package an analysis, model, or data-processing workflow once and make it available through a consistent interface without requiring other lab users to run the Python code manually.

Compute Environment ​

Every module runs in one of two compute environments. You choose one when creating or editing the module:

Setup, time limits and file size limits differ between them, so read the page for the environment you pick.

Guidelines and Limitations ​

We recommend following these key guidelines for error-free deployment and execution of your modules:

  • Python version - use the latest stable Python 3 version (Python 2 is not supported)
  • Dependencies (optional) - use a requirements.txt file and avoid obsolete/abandoned packages
  • Paths - avoid absolute or hard-coded paths, and address your files relative to your script (see section about work directory)

WARNING

Failure to adhere to these guidelines will result in deployment and/or execution errors.

Limits that depend on the compute environment, such as execution time and file size, are listed on the page for the environment you choose.

Large Files ​

We recommend you use Git LFS to handle large files/artifacts if they exceed a size limit imposed by your repository provider. Alternatively, you can bundle all your scripts and model binaries into a zip file, as long as it does not exceed 50 megabytes.

Reserved Parameters/Arguments ​

We have some parameters that are not passed to your script. However, they are reserved for internal use.

  • project
  • job
  • description

Work Directory ​

By default we run scripts in a work directory that is not always the same location of the entry script's location. The work directory is the path to the directory where you create your temporary files and result files.

If you require the work directory's path string explicitly, you can check the box Include work_dir argument. If your script uses positional parameters, please reserve the first parameter as the working directory. If your script uses named parameters, please reserve the parameter name --work_dir.

Deploying a Module ​

The permission Module Creation is required to create or manage your modules.

There are two ways to upload the source code of your module.

Prepare your Python scripts from a GitHub repository. If you are using a private repository, install the deployment key. Enter the repository link and the name of the main script (also known as the entry point).

Upload Method with Manual Script Uploads ​

Attach your main script or a zip archive of your repository. The upload cannot exceed 50 megabytes, whichever compute environment you choose.

Arguments ​

For inputs using positional parameters, the order determines where the parameter will be placed (recall that the first parameter is reserved). Here is a sample of how the positional inputs will be executed where ipm.py is the main script:

bash
python ipm.py {work_dir} {user defined input 1} {user defined input 2} ...

For output, let's suppose that the script will create two files: labels.csv and result.png. In that case, define a CSV output and an image file output. Note that the ordering does not matter.

Supported Input ​

  • ImageFile - extensions include jpg, jpeg, png, gif, bmp, tif, and tiff
  • ImageFile[] - an array of image files
  • CSVFile - extensions include csv, txt, and json
  • CSVFile[] - an array of CSV files
  • VideoFile - extensions include mp4, avi, mov, mkv, and webm
  • VideoFile[] - an array of video files
  • Range - a numeric input within a range
  • Number - a single numeric value
  • Number[] - an array of numeric values that can optionally be a fixed size
  • Text - a string
  • Text[] - an array of string values that can optionally be a fixed size

Supported Output ​

We capture output files based either on the exact name that you provide or by regex. These are the supported output types:

  • ImageFile
  • CSVFile
  • VideoFile

NOTE

We are actively expanding the list of supported input/output types based on demand. If you have an input type that is not in our list, please contact our administrator for assistance.