API Reference
The Service class in the Datatailr system represents a deployable service. It extends the shared Base class and inherits its core features including lifecycle management (start, stop, save, remove), resource configuration, and metadata control.
Attributes:
Name (str): Name of the service.
Description (str): Description.
Image (str): Docker image to deploy.
Entrypoint (str): Command to run inside the container.
Environment (str, default: 'dev'): Deployment environment.
Owner, Group, Permissions, RunAs: User and access control.
AppGroup (str, optional): Logical grouping in the UI.
CPU (int, default: 200): CPU allocation.
Memory (int, default: 250): Memory allocation.
HealthCheckUrl (str, default: '/'): Health endpoint.
SpotInstance (bool, default: False): Use spot pricing.
NumContainers (int, default: 1): Replication count.
ScalingConfig (ScalingConfig): Auto-scaling rules.
Port (int, default: 11111): TCP port the service listens on.
GpuEnabled (bool, default: False): Flag for GPU support.
Methods:
save
: Save and deploy the service.
start
: Start execution.
stop
: Stop containers.
remove
: Stop and unregister the service.
status
: Property that returns job status.
Class Methods:
Service.list_existing
- returns a list of all deployed services, which the user has access to.
Validations:
Entrypoint must exist in the container image.
Port must be in the valid range 1–65535.
Usage example:
from dt.scheduler.api import Service
service = Service(Name='Test Service',
Description='This is a test Service',
Image='Price data processing',
Entrypoint='data_pipeline.data_provider',
CPU=200,
Memory=200)
service.save()
print(f'{service.status=}')
service.stop()
print(f'{service.status=}')
service.start()
print(f'{service.status=}')
service.remove()
print(f'{service.status=}')
service.save()
print(f'{service.status=}')
This will produce the following output:
service.status='running'
service.status='stopped'
service.status='running'
service.status='non_existing'
service.status='running'
After this, your service will be available in the 'Dev Apps' section under the 'Test Service' button.
Updated 3 days ago