Skip to main content

No project description provided

Project description

OpenDAL driver

jumpstarter-driver-opendal provides functionality for interacting with storages attached to the exporter.

Installation

:substitutions:
$ pip3 install --extra-index-url {{index_url}} jumpstarter-driver-opendal

Configuration

Example configuration:

:language: yaml

Configuration Parameters

  • scheme (required): The storage service type (e.g., "fs", "s3", "gcs"). See OpenDAL services for supported options.
  • kwargs (required): Service-specific configuration parameters passed to the OpenDAL operator.
  • remove_created_on_close (optional, default: false): When enabled, automatically removes all files and directories created during the session when the driver is closed.

File/Directory Tracking and Cleanup

The OpenDAL driver tracks all files and directories created during a session:

  • File Creation: Files opened in write modes ("wb", "w", "ab", "a")
  • Directory Creation: Directories created via create_dir()
  • Copy Operations: Target files/directories from copy() operations
  • Rename Operations: Target files/directories from rename() operations (source is removed from tracking)

Automatic Cleanup: The tracking is automatically updated when resources are removed:

  • Delete Operations: delete() removes the path from tracking
  • Remove Operations: remove_all() removes the path from tracking

Cleanup Behavior: When remove_created_on_close: true, all tracked files and directories are automatically removed when the driver closes (filesystem only)

Tracking API

# Get all created resources (files and directories)
created_resources = await driver.get_created_resources()  # Returns set[str]

# Example usage
for path in created_resources:
    print(f"Created: {path}")

Use Cases

Temporary File Management:

# Enable cleanup for temporary storage
remove_created_on_close: true

Persistent Storage:

# Disable cleanup to preserve files (default)
remove_created_on_close: false

Note: Pre-existing files that are written to are treated as "created" since they may be remnants from failed cleanup operations.

API Reference

Examples

>>> from tempfile import NamedTemporaryFile
>>> opendal.create_dir("test/directory/")
>>> opendal.write_bytes("test/directory/file", b"hello")
>>> assert opendal.hash("test/directory/file", "md5") == "5d41402abc4b2a76b9719d911017c592"
>>> opendal.remove_all("test/")
from jumpstarter.config.exporter import ExporterConfigV1Alpha1DriverInstance
from jumpstarter.common.utils import serve

instance = serve(
    ExporterConfigV1Alpha1DriverInstance.from_path("source/reference/package-apis/drivers/opendal.yaml"
).instantiate())

opendal = instance.__enter__()
instance.__exit__(None, None, None)

Client API

.. autoclass:: jumpstarter_driver_opendal.client.OpendalClient()
    :members:

.. autoclass:: jumpstarter_driver_opendal.client.OpendalFile()
    :members:

.. autoclass:: jumpstarter_driver_opendal.common.Metadata()
    :members:
    :undoc-members:
    :exclude-members: model_config

.. autoclass:: jumpstarter_driver_opendal.common.EntryMode()
    :members:
    :undoc-members:
    :exclude-members: model_config

.. autoclass:: jumpstarter_driver_opendal.common.PresignedRequest()
    :members:
    :undoc-members:
    :exclude-members: model_config

.. autoclass:: jumpstarter_driver_opendal.common.Capability()
    :members:
    :undoc-members:
    :exclude-members: model_config

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

jumpstarter_driver_opendal-0.7.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jumpstarter_driver_opendal-0.7.2-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file jumpstarter_driver_opendal-0.7.2.tar.gz.

File metadata

File hashes

Hashes for jumpstarter_driver_opendal-0.7.2.tar.gz
Algorithm Hash digest
SHA256 cdd7ecdbf9b4ca17f3cc4cdf9aba727e91e049805a1b016bd4c3d3d342337136
MD5 06dd75c1fad77b99c6062a0b37906b1a
BLAKE2b-256 9843c3bfcc0c376ca8b85e28420ef3e254b0b99143a53c48fc4734ca345bb412

See more details on using hashes here.

File details

Details for the file jumpstarter_driver_opendal-0.7.2-py3-none-any.whl.

File metadata

File hashes

Hashes for jumpstarter_driver_opendal-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3e427fb8c2048ba1adea9be9af3c22371225f3f3b2ec16bbbc6dbf9b4081d429
MD5 6cc7bcd3c6b01438346272326767f26f
BLAKE2b-256 aa15ca9e2f209f0b7016a278c1c59f837f6343f07bc8fe1977dccd0cbb33ca20

See more details on using hashes here.

Supported by

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