JobsApi
Method |
HTTP request |
Description |
|---|---|---|
POST /jobs/{job-id}/cancel |
Stops a specific job from running for the user. |
|
POST /user-jobs/{job-id}/cancel |
Stops a specific job from running on the server. |
|
GET /jobs/pending/count |
Counts the number of global, pending jobs on the server. |
|
DELETE /jobs/{job-id} |
Deletes job. |
|
GET /admin/jobs/stats |
Get job history status counts |
|
GET /jobs/{job-id} |
Lists jobs associated with the user. |
|
GET /admin/jobs |
List job history |
|
GET /jobs |
Lists jobs associated with the user. |
|
GET /user-jobs |
Lists all jobs running on the system for all users. |
cancel_job
JobDetails cancel_job(job_id)
Stops a specific job from running for the user.
Stops a specific job from running for the user.
Example
Bearer Authentication (bearerAuth):
import h2ogpte.rest_sync
from h2ogpte.rest_sync.models.job_details import JobDetails
from h2ogpte.rest_sync.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_sync.Configuration(
host = "https://h2ogpte.genai.h2o.ai/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_sync.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with h2ogpte.rest_sync.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = h2ogpte.rest_sync.JobsApi(api_client)
job_id = 'job_id_example' # str | Id of the job
try:
# Stops a specific job from running for the user.
api_response = api_instance.cancel_job(job_id)
print("The response of JobsApi->cancel_job:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->cancel_job: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
|---|---|---|---|
job_id |
str |
Id of the job |
Return type
HTTP request headers
Content-Type: Not defined
Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
|---|---|---|
200 |
Successful operation |
- |
400 |
Bad request |
- |
401 |
Unauthorized - Invalid or missing API key |
- |
cancel_user_job
cancel_user_job(job_id, cancel_user_job_request=cancel_user_job_request)
Stops a specific job from running on the server.
As an admin, stops a specific user job from running on the server.
Example
Bearer Authentication (bearerAuth):
import h2ogpte.rest_sync
from h2ogpte.rest_sync.models.cancel_user_job_request import CancelUserJobRequest
from h2ogpte.rest_sync.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_sync.Configuration(
host = "https://h2ogpte.genai.h2o.ai/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_sync.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with h2ogpte.rest_sync.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = h2ogpte.rest_sync.JobsApi(api_client)
job_id = 'job_id_example' # str | Id of the job
cancel_user_job_request = h2ogpte.rest_sync.CancelUserJobRequest() # CancelUserJobRequest | (optional)
try:
# Stops a specific job from running on the server.
api_instance.cancel_user_job(job_id, cancel_user_job_request=cancel_user_job_request)
except Exception as e:
print("Exception when calling JobsApi->cancel_user_job: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
|---|---|---|---|
job_id |
str |
Id of the job |
|
cancel_user_job_request |
[optional] |
Return type
void (empty response body)
HTTP request headers
Content-Type: application/json
Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
|---|---|---|
204 |
Successful operation |
- |
400 |
Bad request |
- |
401 |
Unauthorized - Invalid or missing API key |
- |
count_pending_jobs
CountWithQueueDetails count_pending_jobs()
Counts the number of global, pending jobs on the server.
Counts the number of global, pending jobs on the server.
Example
Bearer Authentication (bearerAuth):
import h2ogpte.rest_sync
from h2ogpte.rest_sync.models.count_with_queue_details import CountWithQueueDetails
from h2ogpte.rest_sync.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_sync.Configuration(
host = "https://h2ogpte.genai.h2o.ai/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_sync.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with h2ogpte.rest_sync.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = h2ogpte.rest_sync.JobsApi(api_client)
try:
# Counts the number of global, pending jobs on the server.
api_response = api_instance.count_pending_jobs()
print("The response of JobsApi->count_pending_jobs:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->count_pending_jobs: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
HTTP request headers
Content-Type: Not defined
Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
|---|---|---|
200 |
Successful operation |
- |
401 |
Unauthorized - Invalid or missing API key |
- |
delete_job
delete_job(job_id)
Deletes job.
Deletes job with a given unique identifier.
Example
Bearer Authentication (bearerAuth):
import h2ogpte.rest_sync
from h2ogpte.rest_sync.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_sync.Configuration(
host = "https://h2ogpte.genai.h2o.ai/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_sync.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with h2ogpte.rest_sync.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = h2ogpte.rest_sync.JobsApi(api_client)
job_id = 'job_id_example' # str | Id of the job
try:
# Deletes job.
api_instance.delete_job(job_id)
except Exception as e:
print("Exception when calling JobsApi->delete_job: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
|---|---|---|---|
job_id |
str |
Id of the job |
Return type
void (empty response body)
HTTP request headers
Content-Type: Not defined
Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
|---|---|---|
204 |
Successful operation |
- |
400 |
Bad request |
- |
401 |
Unauthorized - Invalid or missing API key |
- |
get_admin_jobs_stats
JobHistoryStatsResponse get_admin_jobs_stats(created_after=created_after)
Get job history status counts
Admin-only. Returns job counts by status over the last 7 days by default (or since created_after), including cleared (deleted) jobs to match the job list. Cheap enough for a polling dashboard.
Example
Bearer Authentication (bearerAuth):
import h2ogpte.rest_sync
from h2ogpte.rest_sync.models.job_history_stats_response import JobHistoryStatsResponse
from h2ogpte.rest_sync.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_sync.Configuration(
host = "https://h2ogpte.genai.h2o.ai/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_sync.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with h2ogpte.rest_sync.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = h2ogpte.rest_sync.JobsApi(api_client)
created_after = '2013-10-20T19:20:30+01:00' # datetime | Lower bound on created_at. Defaults to now-7d when omitted. (optional)
try:
# Get job history status counts
api_response = api_instance.get_admin_jobs_stats(created_after=created_after)
print("The response of JobsApi->get_admin_jobs_stats:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->get_admin_jobs_stats: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
|---|---|---|---|
created_after |
datetime |
Lower bound on created_at. Defaults to now-7d when omitted. |
[optional] |
Return type
HTTP request headers
Content-Type: Not defined
Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
|---|---|---|
200 |
Successful operation |
- |
401 |
Unauthorized - Invalid or missing API key |
- |
403 |
Caller is not an admin. |
- |
500 |
Internal server error |
- |
get_job
JobDetails get_job(job_id)
Lists jobs associated with the user.
Lists jobs associated with the user calling this endpoint.
Example
Bearer Authentication (bearerAuth):
import h2ogpte.rest_sync
from h2ogpte.rest_sync.models.job_details import JobDetails
from h2ogpte.rest_sync.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_sync.Configuration(
host = "https://h2ogpte.genai.h2o.ai/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_sync.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with h2ogpte.rest_sync.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = h2ogpte.rest_sync.JobsApi(api_client)
job_id = 'job_id_example' # str | Id of the job
try:
# Lists jobs associated with the user.
api_response = api_instance.get_job(job_id)
print("The response of JobsApi->get_job:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->get_job: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
|---|---|---|---|
job_id |
str |
Id of the job |
Return type
HTTP request headers
Content-Type: Not defined
Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
|---|---|---|
200 |
Successful operation |
- |
400 |
Bad request |
- |
401 |
Unauthorized - Invalid or missing API key |
- |
list_admin_jobs
JobHistoryListResponse list_admin_jobs(cursor_created_at=cursor_created_at, cursor_id=cursor_id, limit=limit, status=status, kind=kind, user_id=user_id, collection_id=collection_id, created_after=created_after)
List job history
Admin-only. Returns the persistent job history from Postgres (all users), newest first, keyset-paginated. Pass back next_cursor_created_at and next_cursor_id from a previous response to continue. Defaults to the last 7 days when created_after is omitted; pass an earlier created_after to read further back. How far back data exists is bounded by the retention setting (telemetry_retention_days, at most 365 days). Includes cleared (deleted) jobs, marked by deleted_at.
Example
Bearer Authentication (bearerAuth):
import h2ogpte.rest_sync
from h2ogpte.rest_sync.models.job_history_list_response import JobHistoryListResponse
from h2ogpte.rest_sync.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_sync.Configuration(
host = "https://h2ogpte.genai.h2o.ai/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_sync.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with h2ogpte.rest_sync.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = h2ogpte.rest_sync.JobsApi(api_client)
cursor_created_at = '2013-10-20T19:20:30+01:00' # datetime | created_at of the last row from the previous page (with cursor_id). (optional)
cursor_id = 'cursor_id_example' # str | id of the last row from the previous page (with cursor_created_at). (optional)
limit = 50 # int | Max rows to return. Defaults to 50, hard-capped at 200. (optional) (default to 50)
status = ['status_example'] # List[str] | Filter by one or more statuses. (optional)
kind = 'kind_example' # str | Filter by job kind (exact match on the raw kind string). (optional)
user_id = 'user_id_example' # str | Filter by owning user id. (optional)
collection_id = 'collection_id_example' # str | Filter by the collection the job operated on. (optional)
created_after = '2013-10-20T19:20:30+01:00' # datetime | Lower bound on created_at. Defaults to now-7d when omitted. (optional)
try:
# List job history
api_response = api_instance.list_admin_jobs(cursor_created_at=cursor_created_at, cursor_id=cursor_id, limit=limit, status=status, kind=kind, user_id=user_id, collection_id=collection_id, created_after=created_after)
print("The response of JobsApi->list_admin_jobs:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->list_admin_jobs: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
|---|---|---|---|
cursor_created_at |
datetime |
created_at of the last row from the previous page (with cursor_id). |
[optional] |
cursor_id |
str |
id of the last row from the previous page (with cursor_created_at). |
[optional] |
limit |
int |
Max rows to return. Defaults to 50, hard-capped at 200. |
[optional] [default to 50] |
status |
Filter by one or more statuses. |
[optional] |
|
kind |
str |
Filter by job kind (exact match on the raw kind string). |
[optional] |
user_id |
str |
Filter by owning user id. |
[optional] |
collection_id |
str |
Filter by the collection the job operated on. |
[optional] |
created_after |
datetime |
Lower bound on created_at. Defaults to now-7d when omitted. |
[optional] |
Return type
HTTP request headers
Content-Type: Not defined
Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
|---|---|---|
200 |
Successful operation |
- |
401 |
Unauthorized - Invalid or missing API key |
- |
403 |
Caller is not an admin. |
- |
500 |
Internal server error |
- |
list_jobs
List[JobDetails] list_jobs()
Lists jobs associated with the user.
Lists jobs associated with the user making call.
Example
Bearer Authentication (bearerAuth):
import h2ogpte.rest_sync
from h2ogpte.rest_sync.models.job_details import JobDetails
from h2ogpte.rest_sync.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_sync.Configuration(
host = "https://h2ogpte.genai.h2o.ai/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_sync.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with h2ogpte.rest_sync.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = h2ogpte.rest_sync.JobsApi(api_client)
try:
# Lists jobs associated with the user.
api_response = api_instance.list_jobs()
print("The response of JobsApi->list_jobs:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->list_jobs: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
HTTP request headers
Content-Type: Not defined
Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
|---|---|---|
200 |
Successful operation |
- |
401 |
Unauthorized - Invalid or missing API key |
- |
list_user_jobs
List[UserJobDetails] list_user_jobs()
Lists all jobs running on the system for all users.
Lists all jobs running on the system for all users (to be used by admins only).
Example
Bearer Authentication (bearerAuth):
import h2ogpte.rest_sync
from h2ogpte.rest_sync.models.user_job_details import UserJobDetails
from h2ogpte.rest_sync.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_sync.Configuration(
host = "https://h2ogpte.genai.h2o.ai/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_sync.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with h2ogpte.rest_sync.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = h2ogpte.rest_sync.JobsApi(api_client)
try:
# Lists all jobs running on the system for all users.
api_response = api_instance.list_user_jobs()
print("The response of JobsApi->list_user_jobs:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->list_user_jobs: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
HTTP request headers
Content-Type: Not defined
Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
|---|---|---|
200 |
Successful operation |
- |
401 |
Unauthorized - Invalid or missing API key |
- |