run_model_on_dataset_file¶
- DatasetsApi.run_model_on_dataset_file(id, modelid, role_id, run_model, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Run an ML model on a dataset file
Invokes an ML model run for a selected file (or file set) on the dataset. Caller must have access to the model and owner/editor on the dataset (else AUTH-1002). For OutputType DatasetData, TargetDatasetId is required and must be an active dataset the caller can write to. Body FileName may be a single path or list depending on DatasetProcessingMode. On success starts the invoke-model step function and returns Message “success” with ModelRunId and FileName. Not idempotent: each call creates a new ModelRunId.
- Parameters:
id (str) – Source dataset ID. Must exist and be active with completed registration (else DS-1019 / DS-1002 / DS-1003). (required)
modelid (str) – ML model ID to run. Caller must have access to this model (else AUTH-1002). (required)
role_id (str) – Amorphic role ID the request is authorized against. Must grant model access and owner/editor on the source (and target) dataset. (required)
run_model (RunModel) – (required)
content_type (str) – Must be application/json when a body is sent.
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: POST /datasets/{id}/files/models/{modelid}/run
Parameter examples¶
Name |
In |
Example |
|---|---|---|
|
header |
|
|
path |
|
|
path |
|
Request¶
Request / response example
{
"FileName": "sales/monthly_orders/upload_date=2026-08-01/file_orders.csv",
"InstanceType": "ml.m5.large",
"TargetDatasetId": "d0e1f2a3-b4c5-6789-0123-456789abcdef"
}
Success (HTTP 200)¶
Model run accepted. Message is “success”. Body also includes ModelRunId (new UUID) and FileName from the request.
Request / response example
{
"Message": "success",
"ModelRunId": "c9d8e7f6-a5b4-3210-9876-543210fedcba",
"FileName": "sales/monthly_orders/upload_date=2026-08-01/file_orders.csv"
}
Errors¶
Documented error codes: IPV-1004, IPV-1002, AUTH-1002, DS-1019, DS-1002, DS-1003, GE-1008.
HTTP 400
Validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: IPV-1004 (file missing, schema/filetype mismatch, missing TargetDatasetId), IPV-1002, AUTH-1002, DS-1019 / DS-1002 (source or target dataset).
File does not exist
{
"Message": "IPV-1004 - File sales/.../file_orders.csv doesnt exist."
}
No model or dataset permission
{
"Message": "AUTH-1002 - User is not authorized to perform this action"
}
HTTP 500
Backend/generic failure. Body is {“Message”: “<CODE> - <text>”} (e.g. DS-1003, GE-1008).