Skip to main content

A python package that enables user to build their custom singularity image on HPC cluster

Project description

Building a singular container for HPC using globus-compute

Context

  • One of the executions configurations of globus-compute requires a registered container which is spun up to execute the user function on the HPC.

  • HPCs do not run docker containers(due to security reasons as discussed here) and support only an apptainer/singularity image.

  • Installing the apptainer setup to build the singularity image locally is not a straightforward process especially on windows and mac systems as discussed in the documentation.

Using this python library the user can specify their custom image specification to build an apptainer/singularity image which would be used to in-turn to run their functions on globus-compute. The library registers the container and returns the container id which would be used by the globus-compute executor to execute the user function.

Prerequisite.

A globus-compute-endpoint setup on HPC cluster.

Example

Consider the following use-case where the user wants to execute a pandas operation on HPC using globus-compute. They need a singularity image which would be used by the globus-compute executor. The library can be leveraged as follows:

from custom_image_builder import build_and_register_container

tutorial_endpoint = "01e21ddf-6eb4-41db-8e1d-2bcfe0c8314f"
container_id = build_and_register_container(endpoint_id=tutorial_endpoint,
                                            image_file_name="my-test-image", 
                                            base_image_type="docker", 
                                            base_image="python:3.8",
                                            pip_packages=["pandas"])

print("Container id ", container_id)

from globus_compute_sdk import Executor

# User function runs on the HPC node
def transform():
    import pandas as pd
    data = {
        'City': ['New York', 'San Francisco', 'Los Angeles']
    }
    return pd.DataFrame(data)


with Executor(endpoint_id=tutorial_endpoint,
              container_id=container_id) as ex:
    fut = ex.submit(transform)
    

print(fut.result())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

custom_image_builder-1.0.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

custom_image_builder-1.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file custom_image_builder-1.0.0.tar.gz.

File metadata

  • Download URL: custom_image_builder-1.0.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.11.5 Linux/6.2.0-1011-azure

File hashes

Hashes for custom_image_builder-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d9f7bb914c054244ba1248ed04a6c3ed525589762ff2125fbc9aae21981b605d
MD5 336cfbb25c2748602841b44df5459630
BLAKE2b-256 90fa54e22ebb8416bf9f929e69832c69d03893841495921513d4536f7b35d360

See more details on using hashes here.

File details

Details for the file custom_image_builder-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for custom_image_builder-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57f6e05745b76e2b26c4fe7ba869b9e7ad672398d275680d7e1b483613971c7c
MD5 4001d82856ecf035ca4a89ceba90f04f
BLAKE2b-256 05b46d9bfca465d8f3a7c12eb31c9f268ab87e90ae0f2d803ed59b331fa809a2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page