Skip to content

Task/prepare 12.0.0 pip packages #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
==========

12.0.0 (2023-06-13)
---------------------

* Initial release for DSS 12.0.0

11.4.1.1 (2023-04-06)
---------------------

Expand Down
32 changes: 31 additions & 1 deletion dataikuapi/apinode_admin_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,57 @@ def __init__(self, uri, api_key):
########################################################

def create_service(self, service_id):
"""
Creates a new API service

:param service_id: id of the created API service
"""
self._perform_empty("POST", "services/", body = {
"serviceId" : service_id
})

def list_services(self):
"""
Lists the currently declared services and their enabled/disabled state

:return: a dict of services containing their id and state, as a JSON object
:rtype: dict
"""
return self._perform_json("GET", "services")

def service(self, service_id):
"""
Gets a handle to interact with a service

:param service_id: id of requested service
:rtype: :class: `dataikuapi.apinode_admin.service.APINodeService`
"""
return APINodeService(self, service_id)

def auth(self):
"""Returns a handle to interact with authentication"""
"""
Returns a handle to interact with authentication

:rtype: :class: `dataikuapi.apinode_admin.auth.APINodeAuth`
"""
return APINodeAuth(self)

def get_metrics(self):
"""
Get the metrics for this API Node

:return: the metrics, as a JSON object
:rtype: dict
"""
return self._perform_json("GET", "metrics")

def import_code_env_in_cache(self, file_dir, language):
"""
Import a code env in global cache from an exported code env base folder

:param file_dir: path of an exported code env base folder
:param language: language of the code env (`python` or `R`)
"""
self._perform_empty("POST", "cached-code-envs", params={
"fileDir": file_dir,
"language": language
Expand Down
56 changes: 39 additions & 17 deletions dataikuapi/apinode_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,49 @@ def forecast(self, endpoint_id, records, forced_generation=None, dispatch_key=No
Forecast using a time series forecasting model on a DSS API node endpoint

:param str endpoint_id: Identifier of the endpoint to query
:param records: List of time series data records to be used as an input for the
time series forecasting model. Each record should be a dict where
keys are feature names, and values feature values.
Example: records = [
{'date': '2015-01-04T00:00:00.000Z', 'timeseries_id': 'A', 'target': 10.0},
{'date': '2015-01-04T00:00:00.000Z', 'timeseries_id': 'B', 'target': 4.5},
{'date': '2015-01-05T00:00:00.000Z', 'timeseries_id': 'A', 'target': 2.0},
...,
{'date': '2015-03-20T00:00:00.000Z', 'timeseries_id': 'B', 'target': 1.3}
]
:param array records: List of time series data records to be used as an input for the
time series forecasting model. Each record should be a dict where
keys are feature names, and values feature values.

Example:

.. code-block:: python

records = [
{'date': '2015-01-04T00:00:00.000Z',
'timeseries_id': 'A', 'target': 10.0},
{'date': '2015-01-04T00:00:00.000Z',
'timeseries_id': 'B', 'target': 4.5},
{'date': '2015-01-05T00:00:00.000Z',
'timeseries_id': 'A', 'target': 2.0},
...
{'date': '2015-03-20T00:00:00.000Z',
'timeseries_id': 'B', 'target': 1.3}
]


:param forced_generation: See documentation about multi-version prediction
:param dispatch_key: See documentation about multi-version prediction

:return: a Python dict of the API answer. The answer contains a "results" key
(which is an array of result objects, corresponding to the forecast records)
Example: {'results': [
{'forecast': 12.57, 'ignored': False, 'quantiles': [0.0001, 0.5, 0.9999], 'quantilesValues': [3.0, 16.0, 16.0],
'time': '2015-03-21T00:00:00.000000Z', 'timeseriesIdentifier': {'timeseries_id': 'A'}},
{'forecast': 15.57, 'ignored': False, 'quantiles': [0.0001, 0.5, 0.9999], 'quantilesValues': [3.0, 18.0, 19.0],
'time': '2015-03-21T00:00:00.000000Z', 'timeseriesIdentifier': {'timeseries_id': 'B'}},
...], ...}
(which is an array of result objects, corresponding to the forecast records)
Example:

.. code-block:: python

{'results': [
{'forecast': 12.57, 'ignored': False,
'quantiles': [0.0001, 0.5, 0.9999],
'quantilesValues': [3.0, 16.0, 16.0],
'time': '2015-03-21T00:00:00.000000Z',
'timeseriesIdentifier': {'timeseries_id': 'A'}},
{'forecast': 15.57, 'ignored': False,
'quantiles': [0.0001, 0.5, 0.9999],
'quantilesValues': [3.0, 18.0, 19.0],
'time': '2015-03-21T00:00:00.000000Z',
'timeseriesIdentifier': {'timeseries_id': 'B'}},
...],
...}
"""

obj = {"items": records}
Expand Down
Loading