HomeGuidesAPI ReferenceChangelog
Log In
API Reference

WizataDSAPIClient

client wrapper to cloud data science API

accessible preferably through wizata_dsapi.api() using os variables, you can also create an instance using init()
please contact your administrator to receive configuration and connection details

Attributes

NameTypeDescription
domainstrURL of data science API
client_idstrazure authentication - client id
client_secretstrazure authentication - your client secret API key
scopestrazure authentication - scope
tenant_idstrazure authentication - tenant
protocolstrdefault - https
usernamestrazure authentication - deprecated - username
passwordstrazure authentication - deprecated - password

Methods

abort()

send an abort request for executions and return a result message

NameTypeDefaultDescription
executionslistmust be a list containing uuid or Execution.

access_check()

call the who am I request, to read proper headers and get specific information.

return: roles, twins

add_template_property()

NameTypeDefaultDescription
template
property_namestr
property_typestrdatapoint
is_requiredboolTrue

authenticate()

perform authentication on client side

await_deployment()

poll a deployment until it stops moving.

NameTypeDefaultDescription
deploymentDeployment or its id.
timeoutint900seconds before giving up waiting.
intervalint5seconds between polls.
return: the Deployment in its final state - check status, which is 'deployed' on success and 'failed' otherwise.

await_execution()

wait for an execution to reach a terminal status (completed, failed or aborted).

NameTypeDefaultDescription
executionExecutionLogExecutionLog returned by experiment() or run().
timeoutint180maximum seconds to wait before raising TimeoutError (default 180).
poll_intervalint5seconds between status checks (default 5).
return: ExecutionLog with terminal status.

batch_query()

NameTypeDefaultDescription
steptimedelta
datapointslistNone
startdatetimeNone
enddatetimeNone
intervalintNone
agg_methodstrmean
templatestrNone
twinstrNone
nullstrNone
filtersdictNone
optionsdictNone
groupdictNone
fieldNone
bucketstrNone
tagsdictNone
verboseboolTrue

branches()

list the branches relevant to a pipeline.

NameTypeDefaultDescription
pipelinepipeline key, UUID or Pipeline.
return: dict with 'default', 'feature' and 'release' - feature branches are this pipeline's drafts, release branches are the frozen refs deployments run from.

build_image()

build an image of a pipeline, store it on the image repository and return its pipeline image id.

NameTypeDefaultDescription
keystrpipeline key.
branchstrNonerelease branch (release/<name>) to freeze the image from. REQUIRED when the tenant has git enabled — the pipeline definition and the raw script sources are both read at that commit, and the resolved sha is recorded in the image (DEV-5965). Ignored when git is disabled.
return: image id.

create()

create and save an object on the server

NameTypeDefaultDescription
objobject from any supported entity (see info()) or python callable function (Script)
return: id of created object

create_branch()

create a branch for a pipeline and return the pipeline as it stands on it.

NameTypeDefaultDescription
pipelinepipeline key, UUID or Pipeline.
namestrNonebranch name. Leave None for a draft, which is named for you. A release is named release/<name>.
sourcestrNoneref to branch from; the default branch when None.
return: the Pipeline read at the new branch, with 'branch' set.

create_component()

create a component based on its ID.

NameTypeDefaultDescription
componentSolutionComponent

create_mobile_tile()

Create a mobile asset tile.

NameTypeDefaultDescription
tileMobileAssetTileMobileAssetTile to create.
return: created MobileAssetTile with server-generated id.

delete()

delete an object on the server

NameTypeDefaultDescription
objobject to delete including all content

delete_branch()

discard a branch.

A draft goes on demand. A release is refused with 409 while a deployment or a

trigger still runs from it - pause or redeploy those first, rather than

leaving a schedule pointing at a ref that no longer exists.

NameTypeDefaultDescription
pipelinepipeline key, UUID or Pipeline.
branchstrbranch ref.

delete_component()

delete component

NameTypeDefaultDescription
component_idUUID

delete_mobile_tile()

Delete a mobile asset tile.

NameTypeDefaultDescription
tile_idstrtile UUID.

delete_model()

delete a model version from the repository.

NameTypeDefaultDescription
identifierstrfull identifier including alias (e.g. 'my_model@alias' or 'my_model.twin@alias').

deploy()

deploy a pipeline: merge the draft, cut the release, build the image and create

the schedule - the whole sequence, as one call.

Returns immediately with a Deployment to poll; an image build outlasts the

gateway timeout, so the record carries the progress instead of the request.

Poll it with :meth:get on the returned id, or :meth:await_deployment.

NameTypeDefaultDescription
pipelinepipeline key, UUID or Pipeline.
twinslistNonehardware ids or twin UUIDs this schedule covers - both forms are accepted - or {twin, target, deviceId} entries where target is "cloud" (default) or "edge".
intervalintNonemilliseconds between runs.
delayintNonemilliseconds to wait after each interval boundary.
packagingstrNone"image" (default) or "release".
sourcestrNonebranch or ref to deploy from.
propertiesdictNonepipeline properties for every run.
plotboolNoneproduce plots on each run. Refused on edge.
trainboolNonetrain models on each run. Refused on edge, and on an image-packaged deployment - the model would be trained and silently discarded, because the image's frozen model is what predict uses.
writeboolNonewrite results back. Defaults on.
return: Deployment to poll.

deploy_preview()

plan a deploy without performing it: what would be merged, cut, built and

scheduled, and every reason it would be refused.

Writes nothing, and always answers 200 - read ok and problems rather

than catching an exception. Takes the same arguments as :meth:deploy.

NameTypeDefaultDescription
pipelinepipeline key, UUID or Pipeline.
kwargs
return: the plan, including 'ok' and 'problems'.

deployed_plot()

fetch one of a deployed pipeline's LIVE plots.

The plot step is identified by BOTH its script and its input dataframe - that

pair is the plot's identity, as :meth:deployed_plots lists it.

Returns the envelope, not the bare figure, because the provenance is the point:

a live plot is overwritten on every run and 'generatedAt' / 'executionId' say

which one wrote it. Render it with client.plot(figure=envelope["figure"]).

NameTypeDefaultDescription
pipelinepipeline key, UUID or Pipeline - both references are accepted.
scriptstrthe plot step's script.
dataframestrthe plot step's input dataframe.
twinstrNonehardware id - required on a templated pipeline.
shapestrfigure'figure' (default) for the stored Plotly figure, or 'data' for its traces projected to 'series'.
return: dict with {pipelineKey, twin, script, dataframe, name, executionId, release, sha, imageId, generatedAt} plus 'figure', or 'series' and 'notProjected' when shape is 'data'.

deployed_plots()

list a deployed pipeline's LIVE plots - what its deployments are currently

drawing, one per (twin, plot step).

A live plot is overwritten on every triggered run, so there is exactly one

current figure per plot and no history to page through. Fetch one with

per execution, see :meth:plots.

NameTypeDefaultDescription
pipelinepipeline key, UUID or Pipeline - both references are accepted.
twinstrNonehardware id, to list only that twin's plots.
return: list of dict {pipelineKey, twin, script, dataframe, key, deploymentId, produced, lastModified, size}. 'produced' is False when the definition has this plot step but no run has written it yet.

download_file()

download a model extra file from the repository.

NameTypeDefaultDescription
modelModelInfoNonemodel (ModelInfo), alternatively can use identifier
fileModelFileNonefile (ModelFile), alternatively can use path
identifierstrNoneidentifier including alias of the model.
pathstrNonepath name of the file including the extension.
return: bytes content.

download_image()

download a pipeline image from the repository

NameTypeDefaultDescription
pipeline_image_idstrid of image
return: packaged (unzipped) as a PipelineImage

download_model()

download a model image directly from the repository, auto-select alias if necessary.

NameTypeDefaultDescription
identifierstrexact identifier including alias of the model or no alias to auto-select active version.
return: ModelInfo with trained_model loaded, extra file must be downloaded separately.

download_script()

Download a script with its artifacts (function/source) as a dill binary.

NameTypeDefaultDescription
namestrscript name.
script_typestrapione of 'api', 'raw', 'module' (default: 'api').
return: Script with function loaded.

experiment()

experiment and train models with a pipeline.

  • existing experiment is required (use create or upsert_experiment(key, name)).

  • if your pipeline is templated please provide a twin.

  • please provide all variables and parameters required through properties.

  • return an execution

  • check status with "wizata_dsapi.api().get(execution).status"

  • see plots with "wizata_dsapi.api().plots(execution)"

NameTypeDefaultDescription
pipelinepipeline identified by key (str) .
experimentNoneexisting experiment identified by key (str).
twinNonetwin identified by hardware ID (str)(optional).
imagestrNonepipeline image id to use.
propertiesdictNonedictionary containing override for variables or additional parameters for your script.
trainboolTruetrain machine learning model on model steps.
plotboolTrueif False plot steps are ignored.
writeboolFalseif False write steps are ignored.
versionstrNoneversion to use, by default use your python environment version.
branchstrNonegit branch to run against (git mode); default branch when omitted.

get()

get record content from DS API.

  • get will look first for obj then for id then for key (e.g. if id and key specified, key is ignored )
NameTypeDefaultDescription
objNonea wizata_dsapi.
idUUIDNonea UUID of a specific object (use in combination of entity)
keystrNonea logical key of a specific object (e.g. hardware id for DataPoint and Twin (use in combination of entity)
entityNoneplural name of the entity or class (use in combination of entity)(e.g. scripts, plots, mlmodels, dataframes...)
script_nameNone
experiment_keyNone
pipeline_keyNone
model_keyNone
template_keyNone
twin_hardware_idNone
datapoint_hardware_idNone
return: object with all properties or None if not found.

get_business_labels()

get a name / uuid dictionary with all business labels in platform.

get_categories()

get a name / uuid dictionary with all categories in platform.

get_components()

get components

NameTypeDefaultDescription
label_idUUIDNonefilter on a specific label
twin_idUUIDNonefilter on a specific twin
template_idUUIDNonefilter on a specific template
owner_idUUIDNonefilter on a specific owner_id
organization_onlyboolFalsework only with organization components (by default - False)
namestrNonefilter on a specific name (contains)

get_datapoint_mappings()

get datapoint mapping from a registration.

NameTypeDefaultDescription
registration

get_mobile_config()

Get resolved config for an asset (twin overrides template).

NameTypeDefaultDescription
template_idstrtemplate UUID.
twin_idstrNoneoptional twin UUID.
return: MobileAssetConfig or None.

get_mobile_tiles()

Get merged tiles for an asset (template + twin overrides).

NameTypeDefaultDescription
template_idstrtemplate UUID.
twin_idstrNoneoptional twin UUID for twin-scoped overrides.
return: list of MobileAssetTile.

get_pipeline_at()

read a pipeline as it stands on a branch, rather than on the default one.

NameTypeDefaultDescription
pipelinepipeline key, UUID or Pipeline.
branchstrbranch ref.
return: Pipeline.

get_registrations()

retrieve all registrations for

NameTypeDefaultDescription
templatetemplate object, UUID or str key.
return: list of twin registration.

get_script_at()

read a RAW script's source as it stands on a branch.

A branch run executes the branch's script, so this is what actually runs

there - the default-branch copy may differ.

NameTypeDefaultDescription
namestrscript name.
branchstrbranch ref.
return: Script.

get_template_properties()

Retrieve all properties for a given template.

NameTypeDefaultDescription
templatetemplate object, UUID or str key.
return: list of TemplateProperty.

get_ts_query()

Get a Query string to Timeseries Database.

NameTypeDefaultDescription
datapointslistNonelist of datapoints to fetch.
startdatetimeNonestart datetime of range to fetch
enddatetimeNoneend datetime of range to fetch
intervalintNoneinterval in milliseconds.
agg_methodstrmean
templatestrNonetemplate to fetch.
twinstrNonehardware ID of twin to fetch based on template.
nullstrNoneBy default at 'drop' and dropping NaN values. If not intended behavior please set it to 'ignore' or 'all'.
filtersdictNonedict of filters.
optionsdictNonedict of options.
return: dataframe

get_units()

get a name / uuid dictionary with all units in platform.

info()

print insights regarding version and supported operations

lists()

lists all elements of a specific entity.

NameTypeDefaultDescription
entityplural name of the entity or class (e.g. scripts, plots, mlmodels, dataframes...)
return: list of all elements with at least the id property.

load_model()

load a model pickle or torch from the repository ready to be used.

NameTypeDefaultDescription
modelModelInfo to load
return: ModelInfo with the trained model.

merge_branch()

merge a draft into the default branch and delete it.

NameTypeDefaultDescription
pipelinepipeline key, UUID or Pipeline.
branchstrthe feature branch to publish.
return: dict with 'merged_sha', 'deleted_branch' and 'files_changed'.

pause_deployment()

pause a deployment: delete its trigger, keep the record.

Synchronous. The manifest is kept, so :meth:resume_deployment rebuilds the

same schedule rather than asking for it again.

NameTypeDefaultDescription
deploymentDeployment or its id.
return: the updated Deployment.

plot()

Fetch and show plot.

NameTypeDefaultDescription
plot_idstrNonePlot Id
plotPlotNoneWizata Plot Object
figureNoneJSON Figure
return: plotly figure

plots()

get all plot for an execution.

NameTypeDefaultDescription
executionExecutionLogid, Execution or ExecutionLog.
return: list of plots (plotly figures).

query()

Query a dataframe from API.

NameTypeDefaultDescription
datapointslistNonelist of datapoints to fetch.
startdatetimeNonestart datetime of range to fetch
enddatetimeNoneend datetime of range to fetch
intervalintNoneinterval in milliseconds.
agg_methodstrmean
templatestrNonetemplate to fetch.
twinstrNonehardware ID of twin to fetch based on template.
nullstrNoneBy default at 'drop' and dropping NaN values. If not intended behavior please set it to 'ignore' or 'all'.
filtersdictNonedict of filters.
optionsdictNonedict of options.
groupNonecan be use to set group system and event retrieving instructions (dict or list[dict]).
fieldNoneby default 'value' if none, accept str or list (e.g. value, reliability, eventId, ...)
bucketstrNonespecify on which bucket the query applies.
tagsdictNone
scopeslistNonelist of scope filters for SCOPED datapoints (e.g. ["normal", {"vibration": {"gte": 0.6}}]).
return: dataframe

query_json()

query time-series as JSON, described.

Takes the same arguments as :meth:query. Where query hands back a

DataFrame, this returns the rows as JSON — and by default wraps them in a

description of their own shape, so a caller that is not pandas can render

them without guessing:

{"columns": [...], "pivot": ..., "data": [...]}

That is what the front-end's query form is built on: an aggregated query

comes back pivoted with one column per datapoint, a raw one comes back long

with a 'value' column, and only the envelope says which you got (DEV-6031).

A separate method rather than a flag on :meth:query, deliberately — a

parameter that changes the return type between a DataFrame and a dict makes

every caller branch on what it asked for.

NameTypeDefaultDescription
include_formatboolTrueFalse to get the bare rows without the envelope.
kwargs
return: dict with columns/pivot/data, or the rows alone when include_format is False.

register_twin()

register a twin on a specific template using a map.

NameTypeDefaultDescription
templatetemplate object, UUID or str key.
twintwin object, UUID or str key.
propertiesdictdict where key = template property and value = datapoint name or const value (str, int, float, relative or epoch datetime).
overrideTrueby default at True - allow overriding any existing subscription

remove_template_property()

NameTypeDefaultDescription
template
property_namestr

resume_deployment()

resume a paused deployment, re-creating its trigger from the stored manifest.

NameTypeDefaultDescription
deploymentDeployment or its id.
return: the updated Deployment.

retry_deployment()

continue a failed or interrupted deployment from where it stopped.

Safe to call repeatedly: a merge or a release cut cannot be undone, so

completed steps are skipped rather than replayed.

NameTypeDefaultDescription
deploymentDeployment or its id.
return: the updated Deployment.

run()

run a pipeline.

  • existing models are used for simulation and prediction.

  • caution this might affect data inside platform or trigger automation.

  • if your pipeline is templated please provide a twin hardware ID.

  • please provide all variables and parameters required through properties.

  • return an execution

  • check status with "wizata_dsapi.api().get(execution).status"

  • check results in platform (dashboard/explorer) or perform queries.

NameTypeDefaultDescription
pipelinepipeline identified by key (str) .
twinNonetwin identified by hardware ID (str)(optional).
propertiesdictNonedictionary containing override for variables or additional parameters for your script.
imagestrNonepipeline image id to use.
trainboolFalsetrain machine learning model on model steps.
plotboolFalseif False plot steps are ignored.
writeboolTrueif False write steps are ignored.
versionstrNoneversion of python environment to use if different than local environment.
branchstrNonegit branch to run against (git mode); default branch when omitted.

save_script_at()

save a RAW script on a branch, leaving the default branch untouched until the

branch is merged.

NameTypeDefaultDescription
scriptScriptScript with its source set.
branchstrbranch ref.

search_datapoints()

get datapoints with a paged query.

NameTypeDefaultDescription
pageint1numero of the page - default 1.
sizeint20quantity per page - default 20 max 100.
sortstridcolumn to sort results - default id.
directionstrascsorting direction by default asc, accept also desc.
hardware_idstrNonefilter on a specific hardware ID name or partial name.
categorieslistNonelist of UUID or Category.
business_typeslistNonelist of BusinessType or str.
twinNoneuuid or Twin element to search datapoints.
recursiveboolFalseset to True in combination of a twin to look inside all sub-twins recursively.
return: PagedQueryResults, check total for number of potential results and results for the list of entity.

search_execution()

search executions using filters, sorting and pagination via POST.

NameTypeDefaultDescription
search_queryNonedict or SearchQuery with filters, sort, page, size, groups, groupSummaries, serviceName.
return: PagedQueryResult with ExecutionLog results and optional group statistics.

search_executions()

get executions with a paged query.

NameTypeDefaultDescription
pageint1numero of the page - default 1.
sizeint20quantity per page - default 20 max 100.
sortstridcolumn to sort results - default id.
directionstrascsorting direction by default asc, accept also desc.
pipeline_idUUIDNonefilter on a specific pipeline.
twin_idUUIDNonefilter on a specific twin.
template_idUUIDNonefilter on a specific template.
statusExecutionStatusNonefilter on a specific status.
return: PagedQueryResults, check total for number of potential results and results for the list of entity.

search_insights()

get insights with a paged query.

NameTypeDefaultDescription
pageint1numero of the page - default 1.
sizeint20quantity per page - default 20 max 100.
sortstridcolumn to sort results - default id.
directionstrascsorting direction by default asc, accept also desc.
datapoint_idstrNoneid of the datapoint on which filtering the insights.
twin_idstrNoneid of the twin on which filtering the insights.
component_idlistNoneid of the component on which filtering the insights.
return: PagedQueryResults, check total for number of potential results and results for the list of entity.

search_models()

get all information related to models stored on Wizata.

return: ModelList structure model list

search_scripts()

Search scripts across all types using a paged query.

NameTypeDefaultDescription
search_queryNoneSearchQuery instance or dict with filters, sort, page, size.
return: PagedQueryResult with Script results.

search_twins()

Search twins using filters, sorting and pagination via POST.

Supported filter fields:

hardwareId, name, description, parentId, twinTypeId, type, isAsset, _search.

NameTypeDefaultDescription
search_queryNoneSearchQuery instance or dict with filters, sort, page, size.
return: PagedQueryResult with Twin results.

send_alerts()

send alerts through backend

NameTypeDefaultDescription
messagestr
recipientslistNone
alert_typeAlertTypeAlertType.SMS
subjectstr
cclistNone

unregister_twin()

un-register a twin from a specific template.

NameTypeDefaultDescription
templatetemplate object, UUID or str key.
twintwin object, UUID or str key.

update()

update and save an object on DS API

NameTypeDefaultDescription
objobject to update on DS API (see info()) or python callable function (Script)

update_component()

update a component based on its ID.

NameTypeDefaultDescription
componentSolutionComponent

update_mobile_tile()

Update an existing mobile asset tile.

NameTypeDefaultDescription
tileMobileAssetTileMobileAssetTile with id set.
return: updated MobileAssetTile.

upload_file()

upload a model extra file to the repository.

please use upload_model for a trained_model

NameTypeDefaultDescription
contentthe bytes content of the file.
modelModelInfoNonemodel (ModelInfo), alternatively can use identifier
fileModelFileNonefile (ModelFile), alternatively can use path
identifierstrNoneidentifier including alias of the model.
pathstrNonepath name of the file including the extension.
return: bytes content.

upload_model()

upload a model within the model repository.

  • by default use model_info.trained_model and convert it to a pickle

  • for already torch or pickle please pass the bytes_content

  • model_info.file_format must be set properly to 'pkl' or 'pt'

NameTypeDefaultDescription
model_infoModelInfomodel info, with at least key (+twin, +property, +alias) and trained_model.
bytes_contentNonebytes[] of your torch or pickle model.

upsert()

upsert an object on the server using its logical unique key (e.g. hardware_id, key, name).

if the object already exists (matched by key), it is updated. otherwise, it is created.

NameTypeDefaultDescription
objobject to upsert on the server (must implement api_key()) or python callable function (Script)
return: ID of the object created or updated

upsert_datapoint()

Upsert a datapoint (ignore ID, use the hardware_id).

NameTypeDefaultDescription
datapointDataPoint
return: upserted datapoint.

upsert_experiment()

Upsert an experiment.

NameTypeDefaultDescription
keystrunique key identifying the experiment.
namestrdisplay name of the experiment.
pipelineNonepipeline to set at creation only - cannot be updated.
twinNonetwin uuid, hardware id or twin.
return: upserted experiment.

upsert_mobile_config()

Upsert mobile asset config by (templateId, twinId).

NameTypeDefaultDescription
configMobileAssetConfigMobileAssetConfig to upsert.
return: upserted MobileAssetConfig.

upsert_pipeline()

Upsert a pipeline (ignore ID, use the key).

NameTypeDefaultDescription
pipelinePipeline
return: upserted pipeline.

upsert_template()

Upsert a template.

NameTypeDefaultDescription
keystrunique key identifying the template.
namestrdisplay name of the template
return: upserted template.

upsert_twin()

Upsert a twin (ignore ID, use the hardware_id).

NameTypeDefaultDescription
twinTwin
return: upserted twin.

who_am_i()

decrypt current JWT token used to get information about current user.

return: