API Reference

The App class in the Datatailr system represents a deployable application. It extends the shared Base class and inherits its core features including lifecycle management (start, stop, save, remove), resource configuration, and metadata control. The App class adds support for application icons.

Attributes:

Name (str): Name of the application.

Description (str): Description of the app.

Image (str): Docker image to use.

Entrypoint (str): Entrypoint to execute in the container.

Environment (str, default: 'dev'): Deployment environment.

Owner (str, default: current user): Owner of the application.

Group (str, default: primary group): Group ownership.

Permissions (str, default: 'rwrwr-'): Access control string.

RunAs (str, default: current user): The user the container runs as.

AppGroup (str, optional): Visual grouping for UI.

CPU (int, default: 200): CPU allocation (MHz).

Memory (int, default: 250): Memory allocation (MB).

HealthCheckUrl (str, default: '/'): HTTP endpoint for health checks.

SpotInstance (bool, default: False): Use spot instances.

NumContainers (int, default: 1): Number of container replicas.

ScalingConfig (ScalingConfig): Auto-scaling configuration.

ProcessesPerContainer (int, default: 5): Number of processes per container.

Icon (str, default: 'fas fa-bath'): Icon class name (must be valid in Icons).

Methods:

save: Save and deploy the app.

start: Start execution.

stop: Stop containers.

remove: Stop and unregister the app.

status: Property that returns job status.

Class Methods:

App.list_existing - returns a list of all deployed apps, which the user has access to.

Validations:

  • Entrypoint must exist in the specified image and match allowed application entrypoints.
  • Icon must match a valid icon class from Icons.value_set.

Usage example:

from dt.scheduler.api import App, Service, Icons

app = App(Name='Test App',
			    Description='This is a test app',
          Image='My app image',
          Entrypoint='my_app.main',
          CPU=2_000,
          Memory=2_000,
          Icon=Icons.fas_fa_angle_down.value)

app.save()
print(f'{app.status=}')
app.stop()
print(f'{app.status=}')
app.start()
print(f'{app.status=}')
app.remove()
print(f'{app.status=}')
app.save()
print(f'{app.status=}')

This will produce the following output:

app.status='running'
app.status='stopped'
app.status='running'
app.status='non_existing'
app.status='pending'

After this, your app will be available in the 'Dev Apps' section under the 'Test App' button.