Index
get_path_delimiter()
The get_path_delimiter function returns the path delimiter for the current operating system.
Returns:
Type | Description |
---|---|
str
|
The appropriate path delimiter for the operating system |
Source code in src/pyplanqk/helpers.py
wait_for_application_job_to_be_finished(url, access_token, timeout=500, step=1)
The wait_for_application_job_to_be_finished function waits for the application job to be finished.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
str: Define the url of the execution |
required |
access_token |
str
|
str: Authenticate the user |
required |
timeout |
int
|
int: Set the timeout for the job to finish |
500
|
step |
int
|
int: Specify the time interval between each request |
1
|
Returns:
Type | Description |
---|---|
bool
|
True if the execution is finished and false otherwise |
Source code in src/pyplanqk/helpers.py
wait_for_service_job_to_be_finished(job_id, api_key, timeout=500, step=1)
The wait_for_service_job_to_be_finished function is used to wait for a service job to be finished. It takes the following parameters: - job_id: The ID of the service job that we want to wait for. - api_key: A dictionary containing an API key and its corresponding secret, which are needed in order to access the Service Platform's APIs. This parameter is optional; if it isn't provided, then default values will be used instead (see below). If you do provide this parameter, then it should have two keys named "apiKey" and "apiSecret", whose values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_id |
str
|
str: Identify the job |
required |
api_key |
Dict[str, str]
|
Dict[str: Define the api key as a dictionary |
required |
str] |
Define the job_id as a string |
required | |
timeout |
int
|
int: Set the time limit for waiting for a job to finish |
500
|
step |
int
|
int: Define the time interval between each status check |
1
|
Returns:
Type | Description |
---|---|
bool
|
True if the service job is finished |
Source code in src/pyplanqk/helpers.py
wait_for_service_to_be_created(service_id, version_id, api_key, timeout=500, step=1)
The wait_for_service_to_be_created function waits for a service to be created.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_id |
str
|
str: Specify the service_id of a service |
required |
version_id |
str
|
str: Specify the version of the service to be deleted |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api_key as a dictionary |
required |
str] |
Define the type of the parameter |
required | |
timeout |
int
|
int: Set the maximum time to wait for the service to be created |
500
|
step |
int
|
int: Specify the time interval between each check |
1
|
|
Get the service id and version id |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the service is created successfully |
Source code in src/pyplanqk/helpers.py
PyPlanQK
Source code in src/pyplanqk/high_level_actions.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
create_data_pool(data_pool_name, file)
The create_data_pool function creates a data pool with the given name and adds the file to it. If a data pool with that name already exists, then it will not be created again.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
self |
Bind the method to an object |
required | |
data_pool_name |
Optional[str]
|
Optional[str]: Specify the name of the data pool |
required |
file |
Create a data pool |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary with the following keys: |
Source code in src/pyplanqk/high_level_actions.py
create_service(config)
The create_service function creates a service in the Watson Machine Learning instance. Args: config (dict): A dictionary containing the configuration for creating a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
self |
Refer to the instance of the class |
required | |
config |
Dict[str, Any]
|
Dict[str: Pass the configuration of the service to be created |
required |
Any] |
Specify the type of the parameter |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary with the following keys: |
Source code in src/pyplanqk/high_level_actions.py
execute_service(service_name, params, data=None, data_ref=None)
The execute_service function is used to execute a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
self |
Bind the function to a class |
required | |
service_name |
str
|
str: Specify the name of the service to be executed |
required |
params |
Dict[str, Any]
|
Dict[str: Pass the parameters to the service |
required |
Any] |
Define the type of data that is passed to the function |
required | |
data |
Dict[str, Any]
|
Dict[str: Pass the data to be processed by the service |
None
|
Any] |
Specify the type of data that is returned by the function |
required | |
data_ref |
Dict[str, Any]
|
Dict[str: Pass the data pool reference |
None
|
Any] |
Define the type of the data that is passed to the function |
required | |
|
Pass the service name to the function |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The result of the service execution |
Source code in src/pyplanqk/high_level_actions.py
add_data_to_data_pool(data_pool_name, file, api_key)
The add_data_to_data_pool function adds a data source to the specified data pool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_pool_name |
str
|
str: Specify the name of the data pool |
required |
file |
Upload a file to the data pool |
required | |
api_key |
str
|
str: Authenticate the user |
required |
Returns:
Type | Description |
---|---|
bool
|
A boolean value |
Source code in src/pyplanqk/low_level_actions.py
create_application(application_name, api_key)
The create_application function creates a new application in the Service Platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
application_name |
str
|
str: Specify the name of the application |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the type of the parameter |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary |
Source code in src/pyplanqk/low_level_actions.py
create_data_pool(data_pool_name, api_key)
The create_data_pool function creates a data pool on the PlanQK platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_pool_name |
str
|
str: Name the data pool |
required |
api_key |
str
|
str: Authenticate the user |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary with the following keys: |
Source code in src/pyplanqk/low_level_actions.py
create_managed_service(config, api_key)
The create_managed_service function creates a managed service in the Service Platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
Dict[str, Any]
|
Dict[str: Pass the configuration parameters to the function |
required |
Any] |
Specify the type of the return value |
required | |
api_key |
Dict[str, str]
|
Dict[str: Pass in the api key to the function |
required |
str] |
Specify the type of the variable |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary with the following keys: |
Source code in src/pyplanqk/low_level_actions.py
get_access_token(consumer_key, consumer_secret, token_url)
The get_access_token function is used to get an access token from the OAuth2 server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
consumer_key |
str
|
str: Pass in the consumer key for the api |
required |
consumer_secret |
str
|
str: Authenticate the client |
required |
token_url |
str
|
str: Specify the url of the token endpoint |
required |
Returns:
Type | Description |
---|---|
str
|
A string |
Source code in src/pyplanqk/low_level_actions.py
get_all_jobs_for_managed_service(service_name, api_key)
The get_all_jobs_for_managed_service function returns a list of all jobs for the specified service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Specify the name of the service |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass in the api key |
required |
str] |
Specify the service name |
required |
Returns:
Type | Description |
---|---|
List[Dict[str, Any]]
|
A list of all jobs for a managed service |
Source code in src/pyplanqk/low_level_actions.py
get_all_service_jobs(api_key)
The get_all_service_jobs function returns a list of all service jobs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
Dict[str, str]
|
Dict[str: Pass in the api key for authentication |
required |
str] |
Specify the type of the parameter |
required |
Returns:
Type | Description |
---|---|
List[Dict[str, Any]]
|
A list of dictionaries |
Source code in src/pyplanqk/low_level_actions.py
get_all_subscriptions(application_name, api_key)
The get_all_subscriptions function retrieves all subscriptions for a given application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
application_name |
str
|
str: Specify the name of the application that you want to get subscriptions for |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the type of the return value |
required |
Returns:
Type | Description |
---|---|
List[Dict[str, Any]]
|
A list of dictionaries |
Source code in src/pyplanqk/low_level_actions.py
get_application(application_name, api_key)
The get_application function retrieves the application with the given name from the Service Platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
application_name |
str
|
str: Specify the name of the application to retrieve |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass in the api key as a dictionary |
required |
str] |
Specify the type of the application_name variable |
required |
Returns:
Type | Description |
---|---|
Optional[Dict[str, Any]]
|
A dictionary with the following keys: |
Source code in src/pyplanqk/low_level_actions.py
get_application_job_info(service_name, job_id, access_token, api_key)
The get_application_job_info function is used to retrieve the status of a job that has been submitted to an application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Identify the service |
required |
job_id |
str
|
str: Identify the job |
required |
access_token |
str
|
str: Authenticate the user |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass in the api key for the service |
required |
str] |
Get the service name |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary that contains the job id, status, and result |
Source code in src/pyplanqk/low_level_actions.py
get_application_job_result(service_name, job_id, access_token, api_key)
The get_application_job_result function is used to retrieve the result of a job that has been submitted to an application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Specify the name of the service |
required |
job_id |
str
|
str: Identify the job |
required |
access_token |
str
|
str: Authenticate the user |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the service name |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The result of the job |
Source code in src/pyplanqk/low_level_actions.py
get_application_job_status(service_name, job_id, access_token, api_key)
The get_application_job_status function is used to get the status of a job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Specify the service name |
required |
job_id |
str
|
str: Identify the job |
required |
access_token |
str
|
str: Authenticate the user |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the service name |
required |
Returns:
Type | Description |
---|---|
str
|
The status of the application job |
Source code in src/pyplanqk/low_level_actions.py
get_data_pool(data_pool_name, api_key)
The get_data_pool function takes a data pool name and an API key as input. It then calls the get_data_pools function to retrieve all of the data pools in your account. The function then iterates through each of these data pools, looking for one with a matching name. If it finds one, it returns that dictionary object representing that specific data pool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_pool_name |
str
|
str: Specify the name of the data pool to be deleted |
required |
api_key |
str
|
str: Authenticate the user |
required |
Returns:
Type | Description |
---|---|
Optional[Dict[str, str]]
|
A dictionary with the following keys: |
Source code in src/pyplanqk/low_level_actions.py
get_data_pool_file_information(data_pool_name, api_key)
The get_data_pool_file_information function returns a dictionary of dictionaries containing information about the files in a data pool. The keys of the outer dictionary are file names, and each inner dictionary contains information about one file. The following keys are available: identifier, data_pool_id, data_source_descriptor_id and file id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_pool_name |
str
|
str: Specify the name of the data pool |
required |
api_key |
str
|
str: Authenticate the user |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary with information about the data pool files |
Source code in src/pyplanqk/low_level_actions.py
get_data_pools(api_key)
The get_data_pools function returns a list of dictionaries containing the data pools.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
str
|
str: Authenticate the user |
required |
Returns:
Type | Description |
---|---|
List[Dict[str, Any]]
|
A list of data pools |
Source code in src/pyplanqk/low_level_actions.py
get_managed_service_job(service_name, job_id, api_key)
The get_managed_service_job function returns a job for the specified service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Identify the service that you want to get a job for |
required |
job_id |
str
|
str: Specify the job to get |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass in the api key for authentication |
required |
str] |
Specify the type of the parameter |
required |
Returns:
Type | Description |
---|---|
Optional[Dict[str, Any]]
|
The job with the given id |
Source code in src/pyplanqk/low_level_actions.py
get_service(service_name, api_key)
The get_service function retrieves a service from the Service Platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Specify the name of the service to be retrieved |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the type of the parameter |
required |
Returns:
Type | Description |
---|---|
Optional[Dict[str, Any]]
|
A service |
Source code in src/pyplanqk/low_level_actions.py
get_service_job(job_id, api_key)
The get_service_job function retrieves a service job from the Service Platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_id |
str
|
str: Specify the job id of the service job you want to get |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass in the api key for authentication |
required |
str] |
Specify the job id |
required |
Returns:
Type | Description |
---|---|
Optional[Dict[str, Any]]
|
A dictionary with the following keys: |
Source code in src/pyplanqk/low_level_actions.py
get_service_job_result(job_id, api_key)
The get_service_job_result function is used to retrieve the result of a service job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_id |
str
|
str: Specify the job id of the service job |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the job id |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary with the following keys: |
Source code in src/pyplanqk/low_level_actions.py
get_service_job_status(job_id, api_key)
The get_service_job_status function returns the status of a service job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_id |
str
|
str: Identify the job |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass in the api key |
required |
str] |
Specify the type of data that is being passed into the function |
required |
Returns:
Type | Description |
---|---|
str
|
The status of the service job |
Source code in src/pyplanqk/low_level_actions.py
get_service_jobs(service_name, api_key)
The get_service_jobs function returns a list of all jobs for the service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Specify the name of the service to get jobs for |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass in the api key to authenticate with the platform |
required |
str] |
Specify the service name |
required |
Returns:
Type | Description |
---|---|
List[Dict[str, Any]]
|
A list of jobs for a service |
Source code in src/pyplanqk/low_level_actions.py
get_services(api_key, lifecycle=None)
The get_services function retrieves all services from the Service Platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the type of the parameter |
required | |
lifecycle |
str
|
str: Filter the services based on their lifecycle |
None
|
Returns:
Type | Description |
---|---|
List[Dict[str, Any]]
|
A list of dictionaries |
Source code in src/pyplanqk/low_level_actions.py
get_subscription(application_name, api_key)
The get_subscription function retrieves the subscription for a given application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
application_name |
str
|
str: Specify the name of the application |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the type of the return value |
required |
Returns:
Type | Description |
---|---|
Optional[Dict[str, Any]]
|
A dictionary with the following keys: |
Source code in src/pyplanqk/low_level_actions.py
get_version(service_name, api_key)
The get_version function returns the version of a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Specify the service name |
required |
api_key |
Dict[str, str]
|
Dict[str: Specify the type of data that is expected to be passed into the function |
required |
str] |
Specify the type of the parameter |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary with the following keys: |
Source code in src/pyplanqk/low_level_actions.py
publish_service_internally(service_name, api_key)
The publish_service_internally function publishes a service internally.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Get the service name |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass in the api key for authentication |
required |
str] |
Specify the service name |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A service object |
Source code in src/pyplanqk/low_level_actions.py
remove_application(application_name, api_key)
The remove_application function removes an application from the Service Platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
application_name |
str
|
str: Identify the application to be removed |
required |
api_key |
Dict[str, str]
|
Dict[str: Specify the type of the parameter |
required |
str] |
Specify the type of the parameter |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the application is removed |
Source code in src/pyplanqk/low_level_actions.py
remove_data_pool(data_pool_name, api_key)
The remove_data_pool function removes a data pool from the PlanQK platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_pool_name |
str
|
str: Identify the data pool |
required |
api_key |
str
|
str: Authenticate the user |
required |
Returns:
Type | Description |
---|---|
bool
|
A boolean value |
Source code in src/pyplanqk/low_level_actions.py
remove_service(service_name, api_key)
The remove_service function removes a service from the Service Platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Identify the service to be removed |
required |
api_key |
Dict[str, str]
|
Dict[str: Specify the type of the parameter |
required |
str] |
Specify the type of the parameter |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the service was removed successfully |
Source code in src/pyplanqk/low_level_actions.py
remove_service_job(job_id, api_key)
The remove_service_job function removes a service job from the platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_id |
str
|
str: Identify the job to be removed |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the job id |
required |
Returns:
Type | Description |
---|---|
bool
|
A boolean value |
Source code in src/pyplanqk/low_level_actions.py
remove_subscription(application_name, api_key)
The remove_subscription function removes a subscription for an application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
application_name |
str
|
str: Identify the application |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key as a dictionary |
required |
str] |
Specify the type of the parameter |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the subscription is removed |
Source code in src/pyplanqk/low_level_actions.py
subscribe_application_to_service(application_name, service_name, api_key)
The subscribe_application_to_service function subscribes an application to a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
application_name |
str
|
str: Specify the name of the application to be subscribed |
required |
service_name |
str
|
str: Specify the name of the service to be subscribed to |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the type of data that is expected in the function |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A subscription object |
Source code in src/pyplanqk/low_level_actions.py
trigger_application_job(service_name, data, params, access_token, api_key)
The trigger_application_job function is used to trigger the execution of a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Identify the service that is being called |
required |
data |
Dict[str, list]
|
Dict[str: Pass the data to the application |
required |
list] |
Specify the list of data to be passed to the application |
required | |
params |
Dict[str, str]
|
Dict[str: Pass parameters to the application |
required |
str] |
Specify the service name |
required | |
access_token |
str
|
str: Authenticate the user |
required |
api_key |
Dict[str, str]
|
Dict[str: Get the api key from the user |
required |
str] |
Specify the service name |
required | |
|
Get the version of the service |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The job id |
Source code in src/pyplanqk/low_level_actions.py
trigger_service_job(service_name, api_key, data=None, params=None, mode='DATA_UPLOAD', data_ref=None, timeout=500, step=1)
The trigger_service_job function triggers a service job on the platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Specify the name of the service |
required |
api_key |
Dict[str, str]
|
Dict[str: Authenticate the user |
required |
str] |
Specify the service name |
required | |
data |
Dict[str, Any]
|
Dict[str: Pass in the input data to the service |
None
|
Any] |
Define the type of data that is returned from the function |
required | |
params |
Dict[str, Any]
|
Dict[str: Pass parameters to the service |
None
|
Any] |
Specify that the function can return any type of data |
required | |
mode |
str
|
str: Specify whether the service job is triggered with data from a data pool or by uploading the data |
'DATA_UPLOAD'
|
data_ref |
Dict[str, Any]
|
Dict[str: Specify the data pool reference |
None
|
Any] |
Specify that the function can return any type of data |
required | |
timeout |
Set the maximum time to wait for a job to finish |
500
|
|
step |
Control the polling interval |
1
|
|
|
Specify the service name |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The job object |
Source code in src/pyplanqk/low_level_actions.py
unpublish_service(service_name, api_key)
The unpublish_service function unpublishes a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
str: Specify the name of the service to be published |
required |
api_key |
Dict[str, str]
|
Dict[str: Pass the api key to the function |
required |
str] |
Specify the service name |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The service object |