8.1.1.1. stelar.client package
Subpackages
- stelar.client.proxy package
- Submodules
- stelar.client.proxy.decl module
- stelar.client.proxy.derived module
- stelar.client.proxy.exceptions module
- stelar.client.proxy.extras module
- stelar.client.proxy.fieldvalidation module
- Proxy field validation
AnyFieldBasicFieldBoolFieldDateFieldDateFmtFieldDictFieldEnumeratedFieldExecStateFieldFieldValidatorFieldValidator.add_check()FieldValidator.check_length()FieldValidator.check_maximum()FieldValidator.check_minimum()FieldValidator.check_null()FieldValidator.convert_to_entity()FieldValidator.convert_to_proxy()FieldValidator.default_value()FieldValidator.repr_constraints()FieldValidator.validate()
FrozenFieldIntFieldJSONFieldLicenseNameFieldListFieldNameFieldStateFieldStrFieldTagNameFieldUUIDFieldVocabNameField
- stelar.client.proxy.property module
- stelar.client.proxy.proxy module
ProxyProxy.delete()Proxy.new()Proxy.new_entity()Proxy.proxy_attrProxy.proxy_autocommit()Proxy.proxy_autosyncProxy.proxy_changedProxy.proxy_from_entity()Proxy.proxy_idProxy.proxy_invalidate()Proxy.proxy_is_purged()Proxy.proxy_registryProxy.proxy_reset()Proxy.proxy_stateProxy.proxy_sync()Proxy.proxy_to_Series()Proxy.proxy_to_entity()Proxy.sProxy.slProxy.srawProxy.ssProxy.sxProxy.sxlProxy.update()
deferred_sync()
- stelar.client.proxy.proxycursor module
- stelar.client.proxy.proxylist module
- stelar.client.proxy.proxysync module
- stelar.client.proxy.refs module
- stelar.client.proxy.registry module
- stelar.client.proxy.schema module
- stelar.client.proxy.tag module
- stelar.client.proxy.typing module
- Module contents
Submodules
stelar.client.admin module
stelar.client.api_call module
- class stelar.client.api_call.api_call(arg: APIContext)[source]
Bases:
api_call_baseClass that exposes the STELAR API for a given entity.
api_call(proxy).foo(…) returns the ‘result’ of the STELAR API response on success, and raises a ProxyOperationError on failure.
api_call(client).foo(…) does the same.
- image_registry_token_create(title: str, expiration: str | None = None)[source]
Create a new image registry token. :param title: The title of the token. :type title: str :param expiration: The expiration date of the token in ISO format. Defaults to None. :type expiration: str | None, optional
- Returns:
A dictionary containing the created token information.
- Return type:
- image_registry_token_list(limit: int = None, offset: int = None)[source]
List image registry tokens.
- relationship_create(subject_id: str, rel: str, object_id: str, comment: str | None = None)[source]
Create a new relationship.
- Parameters:
- Returns:
A dictionary containing the created relationship information.
- Return type:
- relationship_update(subject_id: str, rel: str, object_id: str, comment: str | None = None)[source]
Update the comment of a relationship.
- Parameters:
- Returns:
A dictionary containing the created relationship information.
- Return type:
- relationships_fetch(subject_id: str, rel: str | None = None, object_id: str | None = None, /)[source]
Show relationships for a subject.
- resource_lineage(resource_id: str, forward: bool) dict[source]
Get the backward lineage of a resource.
- task_post_job_output(task_id: str, signature: str, output_spec: dict) dict[source]
Get the output for a job in a task.
- class stelar.client.api_call.api_call_base(arg: APIContext)[source]
Bases:
api_contextAccess the STELAR API using a client or a proxy.
This is the base class for api_call, defining the generic methods for all types of entities.
- dataset_create(**kwargs)
- dataset_delete(id)
- dataset_fetch(limit=None, offset=None)
- dataset_list(limit=None, offset=None)
- dataset_patch(id, **kwargs)
- dataset_purge(id)
- dataset_search(query_spec)
- dataset_show(id)
- dataset_update(id, **kwargs)
- group_add_dataset(id, member_id, capacity=None)
- group_add_group(id, member_id, capacity=None)
- group_add_tool(id, member_id, capacity=None)
- group_add_user(id, member_id, capacity=None)
- group_add_workflow(id, member_id, capacity=None)
- group_create(**kwargs)
- group_delete(id)
- group_fetch(limit=None, offset=None)
- group_list(limit=None, offset=None)
- group_list_members_dataset(id, capacity=None)
- group_list_members_group(id, capacity=None)
- group_list_members_tool(id, capacity=None)
- group_list_members_user(id, capacity=None)
- group_list_members_workflow(id, capacity=None)
- group_patch(id, **kwargs)
- group_purge(id)
- group_remove_dataset(id, member_id)
- group_remove_group(id, member_id)
- group_remove_tool(id, member_id)
- group_remove_user(id, member_id)
- group_remove_workflow(id, member_id)
- group_search(*args, **kwargs)
- group_show(id)
- group_update(id, **kwargs)
- image_registry_token_create(**kwargs)
- image_registry_token_delete(id)
- image_registry_token_fetch(limit=None, offset=None)
- image_registry_token_list(limit=None, offset=None)
- image_registry_token_patch(id, **kwargs)
- image_registry_token_purge(id)
- image_registry_token_search(*args, **kwargs)
- image_registry_token_show(id)
- image_registry_token_update(id, **kwargs)
- license_create(**kwargs)
- license_delete(id)
- license_fetch(limit=None, offset=None)
- license_list(limit=None, offset=None)
- license_patch(id, **kwargs)
- license_purge(id)
- license_search(*args, **kwargs)
- license_show(id)
- license_update(id, **kwargs)
- organization_add_dataset(id, member_id, capacity=None)
- organization_add_group(id, member_id, capacity=None)
- organization_add_tool(id, member_id, capacity=None)
- organization_add_user(id, member_id, capacity=None)
- organization_add_workflow(id, member_id, capacity=None)
- organization_create(**kwargs)
- organization_delete(id)
- organization_fetch(limit=None, offset=None)
- organization_list(limit=None, offset=None)
- organization_list_members_dataset(id, capacity=None)
- organization_list_members_group(id, capacity=None)
- organization_list_members_tool(id, capacity=None)
- organization_list_members_user(id, capacity=None)
- organization_list_members_workflow(id, capacity=None)
- organization_patch(id, **kwargs)
- organization_purge(id)
- organization_remove_dataset(id, member_id)
- organization_remove_group(id, member_id)
- organization_remove_tool(id, member_id)
- organization_remove_user(id, member_id)
- organization_remove_workflow(id, member_id)
- organization_search(*args, **kwargs)
- organization_show(id)
- organization_update(id, **kwargs)
- policy_create(**kwargs)
- policy_delete(id)
- policy_fetch(limit=None, offset=None)
- policy_list(limit=None, offset=None)
- policy_patch(id, **kwargs)
- policy_purge(id)
- policy_search(*args, **kwargs)
- policy_show(id)
- policy_update(id, **kwargs)
- process_add_task(id, member_id, capacity=None)
- process_create(**kwargs)
- process_delete(id)
- process_fetch(limit=None, offset=None)
- process_list(limit=None, offset=None)
- process_list_members_task(id, capacity=None)
- process_patch(id, **kwargs)
- process_purge(id)
- process_remove_task(id, member_id)
- process_search(query_spec)
- process_show(id)
- process_update(id, **kwargs)
- resource_create(**kwargs)
- resource_delete(id)
- resource_fetch(limit=None, offset=None)
- resource_list(limit=None, offset=None)
- resource_patch(id, **kwargs)
- resource_purge(id)
- resource_search(query_spec)
- resource_show(id)
- resource_update(id, **kwargs)
- tag_create(**kwargs)
- tag_delete(id)
- tag_fetch(limit=None, offset=None)
- tag_list(limit=None, offset=None)
- tag_patch(id, **kwargs)
- tag_purge(id)
- tag_search(*args, **kwargs)
- tag_show(id)
- tag_update(id, **kwargs)
- task_create(**kwargs)
- task_delete(id)
- task_fetch(limit=None, offset=None)
- task_list(limit=None, offset=None)
- task_patch(id, **kwargs)
- task_purge(id)
- task_search(*args, **kwargs)
- task_show(id)
- task_update(id, **kwargs)
- tool_create(**kwargs)
- tool_delete(id)
- tool_fetch(limit=None, offset=None)
- tool_list(limit=None, offset=None)
- tool_patch(id, **kwargs)
- tool_purge(id)
- tool_search(query_spec)
- tool_show(id)
- tool_update(id, **kwargs)
- user_create(**kwargs)
- user_delete(id)
- user_fetch(limit=None, offset=None)
- user_list(limit=None, offset=None)
- user_patch(id, **kwargs)
- user_purge(id)
- user_search(*args, **kwargs)
- user_show(id)
- user_update(id, **kwargs)
- vocabulary_create(**kwargs)
- vocabulary_delete(id)
- vocabulary_fetch(limit=None, offset=None)
- vocabulary_list(limit=None, offset=None)
- vocabulary_patch(id, **kwargs)
- vocabulary_purge(id)
- vocabulary_search(*args, **kwargs)
- vocabulary_show(id)
- vocabulary_update(id, **kwargs)
- workflow_create(**kwargs)
- workflow_delete(id)
- workflow_fetch(limit=None, offset=None)
- workflow_list(limit=None, offset=None)
- workflow_patch(id, **kwargs)
- workflow_purge(id)
- workflow_search(query_spec)
- workflow_show(id)
- workflow_update(id, **kwargs)
- stelar.client.api_call.gcall(self, query_spec)
stelar.client.backdoor module
Implement an accessor for CKAN API that bypasses the STELAR API. This is useful for debugging and testing.
- class stelar.client.backdoor.CKAN(context='apitest', client=None)[source]
Bases:
object- A simple-minded back door to CKAN. It assumes that CKAN
is published by the ingress on path ‘/dc’.
Use as follows: First, ensure that there is a context in ~/.stelar containing the field ‘ckan_apitoken’. For example: [apitest] base_url=https://stelar.foo.com username=joe password=joesecret ckan_apitoken: 123415343416151235jgf1gh3412jk1ljh5g1l5g….
Assuming the context is called ‘apitest’ (as above), do
dc = CKAN(‘apitesst’) dc.site_read() # This is like ‘ping’ dc.help_show(name=’site_read’) # shows CKAN help dc.package_list() dc.package_show(id=’shakespeare_novels’)
dc.package_create(name=’just_a_test’, title=’Just a test’, owner_org=’stelar-klms’) dc.package_delete(id=’just_a_test’)
… etc. Use
- class stelar.client.backdoor.api_call_DC(arg: Proxy | Client)[source]
Bases:
api_contextClass that exposes the CKAN API for the Data Catalog.
api_call(proxy).foo(…) returns the ‘result’ of the CKAN API response on success, and raises a ProxyOperationError on failure.
api_call(client).foo(…) does the same.
stelar.client.base module
- class stelar.client.base.BaseAPI(base_url, token_json, tls_verify=True)[source]
Bases:
RegistryCatalogBase class for all parts of the client API.
Its main responsibility is to support API calls to the STELAR server. It also contains logic to manage the proxies.
- DELETE(*endp, **params)[source]
Send a DELETE request to the API.
Example
response = c.DELETE(“v2/dataset”, “my_dataset”)
- Parameters:
*endp – Path components to the API endpoint.
**params – The query parameters to send.
- Returns:
The response object from the API.
- Return type:
requests.Response
- GET(*endp, **params)[source]
Send a GET request to the API.
Examples
response = c.GET(“v2/datasets”) response = c.GET(“v2/dataset”, ‘my_dataset’)
- Parameters:
*endp – Path components to the API endpoint.
**params – The query parameters to send.
- Returns:
The response object from the API.
- Return type:
requests.Response
- PATCH(*endp, params={}, **json)[source]
Send a PATCH request to the API.
Example
response = c.PATCH(“v2/dataset”, “my_dataset”, author=”John Doe”)
- Parameters:
*endp – Path components to the API endpoint.
params – (keyword-only) The query parameters to send.
**json – The JSON data to send.
- Returns:
The response object from the API.
- Return type:
requests.Response
- POST(*endp, params={}, **json)[source]
Send a POST request to the API.
Example
response = c.POST(“v2/dataset”, name=”my_dataset”)
- Parameters:
*endp – Path components to the API endpoint.
params – (keyword-only) The query parameters to send.
**json – The JSON data to send.
- Returns:
The response object from the API.
- Return type:
requests.Response
- PUT(*endp, params={}, **json)[source]
Send a PUT request to the API.
Example
response = c.PUT(“v2/tag”, “my_tag”, display_name=”My Tag”, vocabulary_id=’my_vocabulary’)
- Parameters:
*endp – Path components to the API endpoint.
params – (keyword-only) The query parameters to send.
**json – The JSON data to send.
- Returns:
The response object from the API.
- Return type:
requests.Response
- property api
- api_request(method, endpoint, *, params=None, json=None)[source]
Do an actual API call
Examples
response = api_request(“GET”, “v2/datasets”) response = api_request(“POST”, “v2/dataset”, json={“name”: “my_dataset”})
- property api_url
Return the base URL to the STELAR API
- cursor_for(proxy_type: Type[ProxyClass] | str, **kwargs) ProxyCursor[ProxyClass][source]
Get a cursor for a given proxy type.
- Parameters:
proxy_type – The type of the proxy. This can be provided as a string (the name of the proxy) or as the class itself.
**kwargs – Additional arguments to pass to the cursor.
- Returns:
The cursor for the proxy type.
- Return type:
Example
client.cursor_for(“Dataset”) client.cursor_for(Dataset)
- property klms_info
- listapi(search: str = None, show_verbs: bool = True) list[str][source]
Return a list of all available API endpoints.
if search is provided, it will filter the endpoints to only include those that contain the search term.
- request(method, endpoint, params=None, data=None, headers=None, json=None)[source]
Sends a request to the STELAR API.
The main difference of this method with respect to api_request is that the endpoint is relative to the base URL, and it can include headers, as well as non-JSON data (e.g., form data).
- For example:
response = c.request(“GET”, “api/v2/datasets”) response = c.request(“POST”, “api/v2/dataset”, json={“name”: “my_dataset”})
- Parameters:
method (str) – The HTTP method (‘GET’, ‘POST’, ‘PUT’, ‘DELETE’).
endpoint (str) – The API endpoint (relative to api_url). Can include query parameters.
params (dict, optional) – URL query parameters.
data (dict, optional) – Form data to be sent in the body.
headers (dict, optional) – Additional request headers.
json (dict, optional) – JSON data to be sent in the body.
- Returns:
The response object from the API.
- Return type:
requests.Response
- reset_tokens(token_json)[source]
Reset the primary and refresh tokens.
- Parameters:
token_json – The token response for authentication
- property token
Getter for the token property.
stelar.client.catalog module
- class stelar.client.catalog.CatalogAPI(*args, **kwargs)[source]
Bases:
BaseAPICatalogAPI is a superclass of the STELAR Python Client. It implements data catalog handling methods that utilizes a subset of the available STELAR API Endpoints that are related to catalog management operations (Publishing, Searching etc.).
stelar.client.client module
The Client class is the main STELAR API client object.
The Client class primarily holds the API URL and user credentials needed to access the API.
- class stelar.client.client.Client(context: str = None, *, base_url: str = None, username=None, password=None, token_json: dict = None, tls_verify=True, config_file: PathLike = None)[source]
Bases:
WorkflowsAPI,CatalogAPI,KnowledgeGraphAPI,AdminAPI,S3APIAn SDK (client) for the STELAR API.
- Operation of the STELAR client requires three pieces of information:
The base URL of the STELAR installation.
A username for the user.
Access and refresh tokens for the user. These tokens need to be refreshed periodically.
- The client can be initialized in four ways:
By providing nothing. This is equivalent to specifying the context name “default”.
By providing a context name, which is looked up in the config file (see below).
By providing a base URL, username, and password. The client will then authenticate the user and retrieve the access and refresh tokens. Note that, the password is not stored in the client or anywhere else.
By providing a base URL, username, password, and a token JSON dictionary containing the access token, refresh token, and their expiration times.
When options 3. or 4. above are used, when the tokens expire, the user must call either the method reauthenticate(passwd) providing the password, or calling method reset_tokens(token_json) with a new token JSON dictionary. Again, these tokens will eventually expire.
By contrast, when the client is initialized with a context name, the client automatically reacquires the tokens when they expire, since the context config file contains the password needed to re-authenticate the user.
By default the config file is located at $HOME/.stelar, but can be overridden by providing the ‘config_file’ keyword argument. The config file contains a collection of contexts, and is encoded in the INI format:
[default]base_url=https://klms.example.comusername=joepassword=my!secret[admin]base_url=https://klms.example.comusername=adminpassword=very!secretThe token_json dictionary is expected to have the following (indicative) structure:
{“access_token”: “your_access_token”,“refresh_token”: “your_refresh_token”,“expires_in”: 600,“refresh_expires_in”: 7200,}- Parameters:
context (str) – load the specified context from $HOME/.stelar (or the config_file path). If this is None, the default context is used. If a config file is not found, the base_url, username and password can be provided as keywords.
base_url (str) – The base URL to the STELAR installation. This URL contains only the hostname. Optionally, it may contain a user name and password, as in https://joe:joespassword@klms.example.com/ The user name and password are only used if the keyword arguments ‘username’ and ‘password’ are None.
username (str) – The user name to connect to for this client.
password (str) – The password to authenticate with.
token_json (dict) – A dictionary containing the access token, refresh token, and their expiration times.
tls_verify (bool) – Verify the server TLS certificate. This setting takes precedence if given. If none, the default is to verify.
config_file (PathLike) – Path to the config file. If None, the default of “$HOME/.stelar” is
used.
- property DC
- classmethod authenticate(base_url, username, password, tls_verify=True) dict[source]
Authenticates the user and retrieves access and refresh tokens.
This method sends a POST request to the authentication endpoint using the provided username and password. Upon successful authentication, the method updates the token property and refreshes the token for all subAPI instances.
- Parameters:
- Raises:
RuntimeError – If authentication fails due to incorrect credentials or server issues.
- Returns:
A dict containing the access token, refresh token, token expiration times and the type of token (should be ‘Bearer’).
- reauthenticate(password: str = None)[source]
Refresh the access token for this client.
This method attempts to refresh the access token using the refresh token. If the refresh token is not available, or if it is also stale, the method will attempt to re-authenticate the user.
- Parameters:
password (str) – A password, which is used for username/password authentication. If not provided, the context mechanism is used.
- Raises:
RuntimeError – If the refresh token is invalid or if re-authentication fails.
- classmethod token_refresh(base_url: str, refresh_token: str, tls_verify: bool = True) dict[source]
Use the given refresh token to retrieve new access and refresh tokens.
- Parameters:
- Returns:
A dict containing the access token, refresh token, token expiration times and the type of token (should be ‘Bearer’).
- Raises:
RuntimeError – If authentication fails due to incorrect credentials or server issues.
stelar.client.dataset module
- class stelar.client.dataset.Dataset(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
PackageProxy,LicensedProxyA proxy of a STELAR dataset.
- add_dataframe(df: DataFrame, s3path: str, format: str = None, **kwargs) Resource[source]
Add a DataFrame as a resource to the dataset.
- export_zenodo() dict[source]
Export the dataset to Zenodo.
This method will create and return a new Zenodo record for the dataset. The method returns the Zenodo record as a dictionary.
- Returns:
The Zenodo record for the dataset.
- Return type:
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- class stelar.client.dataset.DatasetCursor(client)[source]
Bases:
PackageCursor[Dataset]- publish_dataframe(df: DataFrame, s3path: str, format: str | None = None, *, write={}, **properties) Dataset[source]
Publish a DataFrame as a new dataset.
The dataframe will be stored at the given path in the format specified by the ‘format’ argument. If the format is not specified, an attempt will be done to infer it from the file extension of the s3path.
Additional arguments to the pandas write method (DataFrame.to_{format}) can be passed using the ‘write’ argument.
- Parameters:
df (pd.DataFrame) – The DataFrame to publish.
s3path (str) – The S3 path to save the DataFrame.
format (str) – The format of the file. If not specified, an attempt will be done to infer it.
write (dict) – Keyword arguments to pass to the write_dataframe function
**properties – Properties of the new dataset.
- publish_file(s3file: str, format: str | None = None, *, resource: dict | None = {}, **dataset_properties) Dataset[source]
Publish a new dataset in the catalog for a single file in Storage.
The main input to this call is a single file in Storage, identified by its S3 URL. By default, this call will create a new dataset in the catalog and a new resource, which will be initialized by provided properties and also by infering properties by analyzing the given S3 URL.
If the
resourceparameter is set explicitly to None, no resource will be created; instead, the dataset will be assigned the given S3 URL as its URL.- Parameters:
s3path (str) – The S3 path to the file.
format (str) – The format of the file. If not specified, an attempt will be done to infer it.
resource_properties (dict) – Properties of the new resource. If this is set explicitly to None, no resource will be created; instead, the dataset
**dataset_properties – Properties of the new dataset.
stelar.client.generic module
Facility for calling the STELAR API.
The functions in this file will be changed (together with this documentation) as the API implementation progresses.
- class stelar.client.generic.GenericCursor(client: Client, proxy_type: Type[ProxyClass])[source]
Bases:
ProxyCursor[ProxyClass],Registry[ProxyClass]
- class stelar.client.generic.GenericProxy(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
Proxy- delete(purge=False)[source]
Delete the entity proxied by this proxy.
If the entity is purged then the deletion is permanent. After the purge deletion, the proxy is left in the ERROR state.
Otherwise, the deletion removes the entity from the active ones, but the entity can still be accessed. Searches will not return the entity.
TODO: Implement entity reclamation for non-purged entities!
- id
The ID not null
- Type:
UUID (read-only)
- class stelar.client.generic.GenericProxyList(eid_list, client, proxy_type)[source]
Bases:
ProxyList- property coll
- stelar.client.generic.generic_create(client: Client, proxy_type: Type[ProxyClass], **properties) ProxyClass[source]
- stelar.client.generic.generic_fetch(client: Client, proxy_type: Type[ProxyClass], *, limit: int, offset: int, **kwargs) Iterator[ProxyClass][source]
- stelar.client.generic.generic_fetch_list(client: Client, proxy_type: Type[ProxyClass], *, limit: int, offset: int, **kwargs) list[str][source]
- stelar.client.generic.generic_fetch_old(client: Client, proxy_type: Type[ProxyClass], *, limit: int, offset: int, **kwargs) Iterator[ProxyClass][source]
stelar.client.group module
- class stelar.client.group.Group(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
GroupBase- proxy_schema = <stelar.client.proxy.schema.Schema object>
- class stelar.client.group.GroupBase(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
NamedProxyProxy for a STELAR Data Catalog group and organization. This is an abstract class. The group subclass is defined later.
- add(member: Proxy, capacity: str = 'member')[source]
Add a member to the group.
- Parameters:
member – The member to add.
capacity – The capacity of the member.
- created
The ‘created’ field
- Type:
datetime|None (read-only)
- property datasets
Get the datasets of the group.
- get_members(proxy_type: type[Proxy], capacity: str | None = None) MemberList[source]
Get the members of the group.
- Parameters:
proxy_type – The type of the members.
capacity – The capacity of the members.
- Returns:
MemberList, a list of members.
- property groups
Get the groups of the group.
- remove(member: Proxy)[source]
Remove a member from the group.
- Parameters:
member – The member to remove.
- property tools
Get the tools of the group.
- property users
Get the users of the group.
- property workflows
Get the workflows of the group.
stelar.client.knowgraph module
stelar.client.license module
- class stelar.client.license.License(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
GenericProxy- id
The ID not null
- Type:
UUID (read-only)
- key
The name field, which is a unique string identifying the entity. not null 2 <= length <= 100
- Type:
str (read-only)
- metadata_created
The ‘metadata_created’ field
- Type:
datetime|None (read-only)
- metadata_modified
The ‘metadata_modified’ field
- Type:
datetime|None (read-only)
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- class stelar.client.license.LicenseCursor(client: Client)[source]
Bases:
GenericCursor[License]Cursor for Licenses.
stelar.client.lineage module
- class stelar.client.lineage.ENode(id: 'UUID', type: 'str', lineage: "'Lineage'")[source]
Bases:
object
- class stelar.client.lineage.EResource(id: 'UUID', type: 'str', lineage: "'Lineage'", package_id: 'UUID | None' = None, url: 'str | None' = None, label: 'str' = '')[source]
Bases:
ENode
- class stelar.client.lineage.ETask(id: 'UUID', type: 'str', lineage: "'Lineage'", label: 'str' = '', state: 'str' = 'unknown', image: 'str | None' = None, process_id: 'UUID | None' = None, start_date: 'datetime | None' = None, end_date: 'datetime | None' = None)[source]
Bases:
ENode
stelar.client.model module
A module containing useful definitions related to STELAR API entities
stelar.client.mutils module
Author: Petrou Dimitrios Organization: Athena Research Center Project Name: STELAR EU Project Info: https://stelar-project.eu/
- stelar.client.mutils.s3spec_to_dict(objspec: str | tuple[str, str] | Object) dict[str, str][source]
Converts an S3 object specification to a dictionary with bucket and object keys.
The main use case for this function is to call client.s3 methods quickly:
client.s3.get_object(**s3spec_to_dict("s3://bucket/object"))
- stelar.client.mutils.s3spec_to_pair(objspec: str | tuple[str, str] | Object) tuple[str, str][source]
Converts an S3 object specification to a pair of bucket and object name.
- stelar.client.mutils.s3spec_to_url(objspec: str | tuple[str, str] | Object) str[source]
Converts an S3 object specification to a URL string.
- Parameters:
objspec (S3ObjSpec) – A URL (string), tuple of two strings,
object. (or minio.datatypes.Object instance representing an S3)
- Returns:
A URL string representing the S3 object.
- Return type:
stelar.client.named module
- class stelar.client.named.NamedProxy(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
GenericProxy,ExtrasProxyProxies for entities with a name which is unique.
Named proxies include those implemented in CKAN as packages or groups. Other entities may have a name atrribute, but it is not unique.
- extras
The field holding extras (additional fields) for this entity. This field should not be accessed directly, instead its contents are available as normal attributes.
- name
The name field, which is a unique string identifying the entity. not null 2 <= length <= 100
- Type:
str (read-only)
- state
The ‘state’ field not null
- Type:
OneOf[‘active’, ‘deleted’] (read-only)
stelar.client.package module
Declare utilities for package-derived types of entities.
These will be: - datasets - workflows - workflow processes - tools
- class stelar.client.package.PackageCursor(client, proxy_type)[source]
Bases:
GenericCursor[PackageProxy]A cursor for package-based entities (datasets, tools, workflows etc).
This cursor provides package-specific methods for searching and filtering the entities, based on CKAN’s Solr backend.
- property default_organization
Return the default organization.
This is a cached property, used in the initialization of the organization field at PackageProxy creation.
- search(*, q: str | None = None, bbox: list[float] | None = None, fq: list[str] = [], fl: list[str] = None, sort: str = None, limit: int | None = None, offset: int | None = None, facet: dict[str, Any] | None = None)[source]
Search for package-based entities (datasets, tools, workflows etc).
This is the main function for searching the data catalog for packages. Many other functions are implemented on top of this one.
- Parameters:
q – The query string.
bbox – A list of four floats representing the bounding box of a spatial query.
fq – A list of filter queries. These are not used to obtain the score of the results, but instead just to filter the results. They are quite efficient.
fl – A list of fields to return. If None, a proper entity is returned. Note that some fields are special (not actually attribute fields), e.g., the score field.
sort – The fields to sort by. Sorting can be ascending or descending.
limit – The maximum number of results to return.
offset – The offset to start from.
facet – A dictionary of facet field spec (facet attributes and limits).
- Returns:
count: The number of results found (not the number of results returned).
results: A list of results.
facets: A dictionary of facets.
- Return type:
An answer which contains the following fields
- with_tag(tagarg: Tag | str, *, limit: int | None = None, offset: int | None = None)[source]
Return a list of entities ids which have the given tag
- Parameters:
tagarg – A Tag (proxy) or tagspec (a string)
limit – The maximum number of results to return.
offset – The offset to start from.
- Returns:
A proxy list of entity ids
- class stelar.client.package.PackageProxy(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
NamedProxy,TaggableProxy- add_relationship(rel: Rel | str, obj: PackageProxy | UUID, comment: str | None = None)[source]
Add a relationship with this package as subject.
- Parameters:
rel – The relationship type to add.
obj – The object to relate to, either a PackageProxy or UUID.
comment – An optional comment for the relationship.
Returns:
- add_resource(**properties)[source]
Add a new resource with the given properties.
- Example: new_rsrc = d.add_resource(name=”Profile”, url=”s3://datasets/a.json”,
format=”json”, mimetype=”application/json”)
- Parameters:
**properties – The arguments to pass. See ‘Resource’ for details.
- creator
creator_user_id
- Type:
UUID|None (read-only)
- Type:
The ‘creator’ field JSON field
- metadata_created
The ‘metadata_created’ field
- Type:
datetime|None (read-only)
- metadata_modified
The ‘metadata_modified’ field
- Type:
datetime|None (read-only)
- organization
owner_org
- Type:
- Type:
The ‘organization’ field not null JSON field
- relationships
The ‘relationships’ field
- Type:
Any|None (read-only)
stelar.client.pdutils module
Utilities related to the Pandas library.
- class stelar.client.pdutils.StelarDataFrameAccessor(df: DataFrame)[source]
Bases:
object
- class stelar.client.pdutils.StelarSeriesAccessor(ds: Series)[source]
Bases:
object
- stelar.client.pdutils.get_pandas_storage_options(client: Client)[source]
Get the storage options for a pandas read/write operation.
Pandas supports access to files stored in S3, but it requires the credentials to be passed as a dictionary. This function returns the dictionary with the credentials from the client.
- stelar.client.pdutils.infer_format(path: str, hint: str = None) str | None[source]
Infer the format of a file from its extension, or a hint.
- stelar.client.pdutils.read_dataframe(client: Client, path: str, format=None, **kwargs) pd.DataFrame[source]
Read a DataFrame from a file.
This function reads a DataFrame from a file and returns it.
- Parameters:
client (Client) – The client to use to read the file.
path (str) – The path to the file to read. This must be an “s3” URL.
format (str, optional) – The format of the file to read. If not specified, the format will be inferred from the file extension.
kwargs (dict) – Additional keyword arguments to pass to the read”
- stelar.client.pdutils.write_dataframe(client: Client, df: pd.DataFrame, path: str, format=None, **kwargs)[source]
Write a DataFrame to a file.
This function writes a DataFrame to a file.
- Parameters:
client (Client) – The client to use to write the file.
df (pd.DataFrame) – The DataFrame to write.
path (str) – The path to the file to write.
format (str, optional) – The format of the file to write. If not specified, the format will be inferred from the file extension.
kwargs (dict) – Additional keyword arguments to pass to the write
stelar.client.policy module
- class stelar.client.policy.Policy(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
GenericProxyA proxy for a STELAR policy.
- created_at
The ‘created_at’ field not null
- Type:
datetime (read-only)
- id
policy_uuid
- Type:
UUID (read-only)
- Type:
The ID not null JSON field
- policy_name
policy_familiar_name
- Type:
- Type:
The name of the policy to be applied. not null JSON field
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- property spec
A property that returns the policy content as a byte array.
- class stelar.client.policy.PolicyCursor(client)[source]
Bases:
GenericCursorA cursor for iterating over policies.
- property active
stelar.client.process module
- class stelar.client.process.ExecStateField(*args, **kwargs)[source]
Bases:
EnumeratedField- VALUES = ['running', 'succeeded', 'failed']
- class stelar.client.process.Process(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
PackageProxyProxy object for workflow processes (executions).
- end_date
The ‘end_date’ field
- Type:
datetime|None
- exec_state
The ‘exec_state’ field
- Type:
OneOf[‘running’, ‘succeeded’, ‘failed’]|None (read-only)
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- start_date
The ‘start_date’ field
- Type:
datetime|None (read-only)
- terminate(new_state: str = 'succeeded')[source]
Terminate the process execution.
This call transitions the exec_state of the process to the given state. The only meaningful values are those validated with the ExecStateField (namely, ‘running’, ‘succeeded’, ‘failed’).
Note, that the process must be ‘running’ for this call to have any effect.
- Parameters:
new_state – The new state to transition to.
- class stelar.client.process.ProcessCursor(client)[source]
Bases:
PackageCursor[Process]
stelar.client.relationship module
- class stelar.client.relationship.Rel(value)[source]
Bases:
EnumEnum for relationship types.
- CHILD_OF = 'child_of'
- DEPENDENCY_OF = 'dependency_of'
- DEPENDS_ON = 'depends_on'
- DERIVES_FROM = 'derives_from'
- HAS_DERIVATION = 'has_derivation'
- LINKED_FROM = 'linked_from'
- LINKS_TO = 'links_to'
- PARENT_OF = 'parent_of'
- class stelar.client.relationship.RelProxy(subj: PackageProxy)[source]
Bases:
objectA proxy for a set of relationships.
- add(rel: Rel | str, obj: PackageProxy | UUID, comment: str | None = None) Relationship[source]
Add a relationship to the subject.
- property child_of: Relationships
- property dependency_of: Relationships
- property depends_on: Relationships
- property derives_from: Relationships
- get(rel: Rel | str, obj: PackageProxy | UUID) Relationship[source]
- property has_derivation: Relationships
- property linked_from: Relationships
- property links_to: Relationships
- property parent_of: Relationships
- class stelar.client.relationship.Relationship(client: Client, reldata: Dict[str, Any])[source]
Bases:
object- canonical() Relationship[source]
Return the canonical version of the relationship.
- classmethod from_triple(subject: PackageProxy, rel: Rel, object: PackageProxy, comment: str | None = None) Relationship[source]
- matches(subj: MatchExpr, rel: Rel | str | None, obj: MatchExpr) bool[source]
Check if the relationship matches the given subject, relationship type, and object.
Matching is semantic, i.e., a PARENT_OF will match a CHILD_OF relationship if the subject and object are reversed.
A match expression can be - A proxy object - A UUID - A string matching the name of the package entity - A proxy type (Dataset, Process, etc.) matching the type - None (to ignore that part of the match)
- Parameters:
subj – The subject to match against, either a PackageProxy or UUID.
rel – The relationship type to match against, if specified.
obj – The object to match against, either a PackageProxy or UUID.
- Returns:
- True if the relationship matches the given subject and optional relationship type,
False otherwise.
- Return type:
- property object: PackageProxy
Return a proxy to the object of the relationship.
- peer() Relationship[source]
Return the peer relationship.
- property subject: PackageProxy
Return a proxy to the subject of the relationship.
- class stelar.client.relationship.Relationships(client: Client, relationships: Iterable[Relationship] = [])[source]
Bases:
setA set of relationships.
- entities() set[PackageProxy][source]
Return a set of entities in the relationships.
Entities are either subjects or objects of some relationship.
- classmethod from_api(client: Client, reldata: Iterable[Dict[str, Any]]) Relationships[source]
Create a Relationships from API data.
- matching(subj: MatchExpr, rel: Rel | str | None, obj: MatchExpr) Relationships[source]
Return the relationships matching a pattern.
This method filters the relationships in the set based on the provided subject, rel and object. If any of these parameters are None, they are ignored in the matching. Note that matching is done semantically, i.e., a PARENT_OF matches a CHILD_OF, reversing the subject and object.
For this, the matches method of the Relationship class is used.
- Parameters:
subj – The subject to match against, either a PackageProxy or UUID.
rel – The relationship type to match against, if specified.
obj – The object to match against, either a PackageProxy or UUID.
- Returns:
A new set of relationships that match the criteria.
- Return type:
- objects(ptype: type[PackageProxy] | None = None) set[PackageProxy][source]
Return a set of the objects in the relationships.
This call is similar to entities(), but only returns the objects of the relationships, optionally filtered by type. Note that the
- Parameters:
ptype – If specified, only return objects of this type.
- Returns:
A set of the objects in the relationships.
- stelar.client.relationship.entity_data_matches(edata: Dict[str, Any], match: MatchExpr) bool[source]
Check if the entity data matches the given match expression.
A match expression can be: - A proxy object - A UUID - A string matching the name of the package entity - A proxy type (Dataset, Process, etc.) matching the type - None (to ignore that part of the match)
- Parameters:
edata – The entity data to check against.
match – The match expression to check.
- Returns:
True if the entity data matches the expression, False otherwise.
- Return type:
stelar.client.reprstyle module
Generation of rich (e.g., html) representations for proxies.
Code used here follows the ipython rich display protocol, which is described in the IPython documentation.
It is also useful in the context of Jupyter notebooks, where the representation of objects can be customized to provide a richer experience to the user.
stelar.client.resource module
- class stelar.client.resource.ExtrasResourceProperty(**kwargs)[source]
Bases:
ExtrasPropertyThe handling of extras is different for Resource entities.
- convert_entity_to_proxy(proxy: Proxy, entity: Any, **kwargs)[source]
Update proxy dict to represent this property from the entity
- convert_proxy_to_entity(proxy: Proxy, entity: dict, **kwargs)[source]
Update entity dict to represent this property from the proxy. The changes flag is true when the proxy_attr is actually the Proxy.proxy_changes dict.
- convert_to_create(proxy_type, create_props: dict, entity_props: dict, **kwargs)[source]
Convert a value to be used for entity creation.
- Parameters:
client (Client) – The client used for creation.
proxy_type (ProxyClass) – The entity type being created.
create_props – The object passed to the create client call
entity_props – The entity object given to the create API call.
- class stelar.client.resource.PackageField(ref_property: Reference, ref_typename: str, **kwargs)[source]
Bases:
RefFieldA field validator for package references.
- property proxy_type
Return the proxy type for the package reference.
- class stelar.client.resource.PackageRef[source]
Bases:
ReferenceA polymprphic reference to a package entity, used in Resource.
- ENTITIES = ('Dataset', 'Process', 'Tool', 'Workflow')
- VALIDATOR_CLASS
alias of
PackageField
- property proxy_types
Return the proxy types that this reference can point to.
- class stelar.client.resource.Resource(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
GenericProxyA proxy for a STELAR resource with metadata and additional details.
- cache_last_updated
The ‘cache_last_updated’ field
- Type:
datetime|None
- created
The ‘created’ field
- Type:
datetime|None
- id
The ID not null
- Type:
UUID (read-only)
- last_modified
The ‘last_modified’ field
- Type:
datetime|None
- lineage(forward=False) Lineage[source]
Get the lineage of this resource.
The lineage is a directed graph of resources and tasks that are reachable from this resource. Arcs in the graph correspond to resources being inputs or outputs of tasks. The lineage is used to track the flow of data and tasks in the STELAR system.
The lineage can be either forward (from this resource to its descendants) or backward (from this resource to its ancestors).
- metadata_modified
The ‘metadata_modified’ field
- Type:
datetime|None (read-only)
- open(mode='rb', **kwargs)[source]
Open the resource for reading or writing.
- Parameters:
mode (str) – The mode in which to open the resource. This can be one of the following: ‘r’, ‘rb’, ‘w’, ‘wb’, ‘a’, ‘ab’.
- Returns:
A file-like object that can be used to read or write data.
- Return type:
file-like
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- class stelar.client.resource.ResourceCursor(api)[source]
Bases:
GenericCursorA cursor for a collection of STELAR resources.
- for_object(s3obj_spec: S3ObjSpec) ProxyVec[source]
Return resources for a given S3 object specification.
- Parameters:
s3obj_spec (S3ObjSpec) – The S3 object specification.
- Returns:
A vector of resources for the given S3 object
- Return type:
- search(*, query: list[str] | None = [], order_by: str = None, limit: int | None = None, offset: int | None = None)[source]
Search for resources.
This is the main function for searching the data catalog for resources. Other functions are implemented on top of this one.
A resource query is a conunction of query terms of the form <field>:<match>. The query terms are combined with AND. The match is a string with optional wildcards.
- Parameters:
query – A list of query strings. Each query string is of the form “<field>:<text>”.
order_by – A field to order by. Only a single field is allowed and only ascending order is supported.
limit – The maximum number of results to return.
offset – The offset to start from.
- Returns:
count: The number of results found (not the number of results returned).
results: A list of dicts, each corresponding to a resource entity.
- Return type:
An answer dict which contains the following fields
stelar.client.s3 module
- class stelar.client.s3.S3API(*args, **kwargs)[source]
Bases:
BaseAPI- property s3: Minio
- s3fs() S3FileSystem[source]
Return a file-system handler for the data lake.
This method returns an instance of the s3fs.S3FileSystem class that can be used to interact with the data lake.
Please see <https://github.com/fsspec/s3fs/> for more information.
stelar.client.spatial module
stelar.client.task_spec module
Basic support for tasks in the client.
- class stelar.client.task_spec.TaskSpec(tool: ToolSpec = None, *, image: ImageSpec = None, name: str = None)[source]
Bases:
objectA task spec is used to create tasks.
Contrary to other entities, Task creation is more complicated than simply providing values for some scalar attributes. Tasks, once created are not really editable; therefore, all task fields must be specified at task creation time.
This class helps by collecting arguments needed to initialize a new Task.
- d(alias: str, dset: Dataset | UUID | str | None = None, **dspec) TaskSpec[source]
Add a dataset alias in the task spec.
An alias stands for either an existing dataset or for the spec of a future dataset.
Dataset aliases can be useful in specifying input and output arguments to a task.
- classmethod from_json(json_spec: dict) TaskSpec[source]
Create a TaskSpec from a JSON specification.
- Parameters:
json_spec (dict) – the JSON specification for the task spec.
stelar.client.tasks module
Basic support for tasks in the client.
- class stelar.client.tasks.Task(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
GenericProxy- abort(message: str = None)[source]
Abort this task.
This method sets the task’s execution state to ‘failed’ and updates the messages property with the provided message.
- done
The ‘done’ field
- Type:
Any|None (read-only)
- end_date
The ‘end_date’ field
- Type:
datetime|None (read-only)
- exit_job(*, metrics={}, output={}, message='The task is finished', status='succeeded', signature=None)[source]
Post the job output for this external task.
The job output contains the outputs and metrics of the task, the final message and a task status.
- Parameters:
metrics (dict) – A dictionary of metrics to post.
output (dict) – A dictionary of outputs to post.
message (str) – A message to post with the job output.
status (str) – The status of the task, e.g., “succeeded” or “failed”.
signature (str, optional) – The signature of the task. If not provided, the signature will be fetched.
- Raises:
ValueError – If the task is not external or if the POST request fails.
- fail(message: str, *, metrics={}, output={})[source]
Mark this external task as failed with a message.
This method sets the task’s execution state to ‘failed’ and updates the messages property with the provided message.
- id
The ID not null
- Type:
UUID (read-only)
- is_external
The ‘is_external’ field
- Type:
Any|None (read-only)
- property job_input: dict
Return the job input for this local task.
The job input is a dictionary that contains the inputs and parameters of the task, formatted for use in a job execution context.
- metrics
The ‘metrics’ field not null
- Type:
Dict[<class ‘str’>,<class ‘str’>] (read-only, deletable)
- outputs
The ‘outputs’ field not null
- Type:
Dict[<class ‘str’>,<class ‘dict’>] (read-only, deletable)
- parameters
The ‘parameters’ field not null
- Type:
Dict[<class ‘str’>,<class ‘str’>] (read-only, deletable)
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- runtime
The ‘runtime’ field
- Type:
Any|None (read-only)
- property signature: str
Fetch the signature for this task.
The signature is a unique identifier for the task, which allows calling methods job_input() and exit_job() to implement an external task, even from a connection that is not authenticated.
- start_date
The ‘start_date’ field
- Type:
datetime|None (read-only)
- tags
The ‘tags’ field not null
- Type:
Dict[<class ‘str’>,<class ‘str’>] (read-only, deletable)
- class stelar.client.tasks.TaskCursor(api)[source]
Bases:
GenericCursorA cursor for a collection of STELAR tasks.
- create(process_id: UUID | str, task_spec: TaskSpec, secrets=None) Task[source]
Create a new Task using the provided TaskSpec.
- created(*, limit: int = 100, offset: int = 0) list[Task][source]
Fetch a list of tasks in the ‘created’ state.
- failed(*, limit: int = 100, offset: int = 0) list[Task][source]
Fetch a list of tasks in the ‘failed’ state.
- fetch_list(*, state='created', limit: int = 100, offset: int = 0) list[Task][source]
Fetch a list of tasks in a specific state.
- running(*, limit: int = 100, offset: int = 0) list[Task][source]
Fetch a list of tasks in the ‘running’ state.
stelar.client.tool module
- class stelar.client.tool.Image(is_manifest_list: bool, last_modified: datetime, manifest_digest: str, tool: Tool, name: str, reversion: bool, size: int, start_ts: datetime)[source]
Bases:
objectA container image used by a tool.
Images are just information objects, they are not proxies.
- property id
Return a unique identifier for this image.
- class stelar.client.tool.ImageRegistryToken(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
GenericProxyA token representing an image used by a tool.
- DATEFORMAT = '%a, %d %b %Y %H:%M:%S %z'
- created
The ‘created’ field
- Type:
datetime|None (read-only)
- expiration
The ‘expiration’ field
- Type:
datetime|None (read-only)
- id
uuid
- Type:
UUID (read-only)
- Type:
The ID not null JSON field
- last_accessed
The ‘last_accessed’ field
- Type:
datetime|None (read-only)
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- class stelar.client.tool.ImageRegistryTokenCursor(client)[source]
Bases:
GenericCursor[ImageRegistryToken]A cursor for iterating over image registry tokens.
- class stelar.client.tool.ProfilesField(**kwargs)[source]
Bases:
AnyFieldA field for storing tool profiles as a dictionary.
- class stelar.client.tool.Tool(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
PackageProxy,LicensedProxy- category
The ‘category’ field
- Type:
OneOf[‘discovery’, ‘interlinking’, ‘annotation’, ‘other’]|None
- get_image(name: str | None = None, default=None) Image | None[source]
Return the image of the given name, or the default image
for this tool, if any.
- get_profile(name='default', default=None) ToolProfile | None[source]
Return the tool profile for the given name.
- images
The ‘images’ field
- Type:
Any|None (read-only)
- inputs
The ‘inputs’ field not null
- Type:
Dict[<class ‘str’>,<class ‘str’>]
- outputs
The ‘outputs’ field not null
- Type:
Dict[<class ‘str’>,<class ‘str’>]
- parameters
The ‘parameters’ field not null
- Type:
Dict[<class ‘str’>,<class ‘str’>]
- profiles
The ‘profiles’ field not null
- Type:
Any
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- class stelar.client.tool.ToolCategoryField(*args, **kwargs)[source]
Bases:
EnumeratedField- VALUES = ['discovery', 'interlinking', 'annotation', 'other']
- class stelar.client.tool.ToolCursor(client)[source]
Bases:
PackageCursor[Tool]
- class stelar.client.tool.ToolProfile(image: str | None = None, description: str | None = None, image_pull_policy: str | None = None, image_pull_secrets: list[str] | None = None, cpu_request: str | None = None, cpu_limit: str | None = None, memory_request: str | None = None, memory_limit: str | None = None, backoff_limit: int | None = None, restart_policy: str | None = None, ttl_seconds_after_finished: int | None = None)[source]
Bases:
objectAn object specifying options for executing images of a tool.
stelar.client.user module
- class stelar.client.user.User(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
GenericProxy- id
The ID not null
- Type:
UUID (read-only)
- joined_date
The ‘joined_date’ field
- Type:
datetime|None (read-only)
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- remove_role(role: str)[source]
Remove a role from the user.
- Parameters:
role (str) – The role to remove.
- roles
The ‘roles’ field
- Type:
Any|None (read-only)
- class stelar.client.user.UserCursor(client)[source]
Bases:
GenericCursor[User]- create(**kwargs) User[source]
Create a new user.
- Parameters:
**kwargs – The user attributes to set.
- Returns:
The created user.
- Return type:
stelar.client.utils module
stelar.client.vocab module
- class stelar.client.vocab.Tag(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
GenericProxyA proxy for vocaublary tags.
There is not much interesting functionality, since tags are not updatable. However, this proxy class allows for creation and deletion of vocabulary tags.
Note that free tags (those without a vocabulary) in the Data Catalog are managed by the underlying CKAN implementation automatically (as they appear in tag fields for datasets, groups, organizations, etc.)
- get_tagged_datasets() ProxyList[Dataset][source]
Retrieve a number of datasets tagged with this tag.
Note that there is an upper limit to the number of datasets (currently, 1000). For a more flexible access, the dataset search facility (Client.datasets.with_tag()) can be used.
However, this call is convenient for ‘rare’ tags.
- id
The ID not null
- Type:
UUID (read-only)
- name
The name field, which is a unique string identifying the entity. not null 2 <= length <= 100
- Type:
str (read-only)
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- tagspec
The ‘tagspec’ field
- Type:
Any|None (read-only)
- vocabulary
vocabulary_id
- Type:
Vocabulary (read-only)
- Type:
The ‘vocabulary’ field not null JSON field
- class stelar.client.vocab.TagCursor(client: Client)[source]
Bases:
GenericCursor[Tag]Tag cursors are a bit different, since they need to cater to free tags as well as vocabulary tags, and be fast about searching tags.
The cursor fetches only retrieve free tags. However, there are other facilities that allow for the retrieval of all types of tags, as well as search operations using them.
- class stelar.client.vocab.Vocabulary(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
GenericProxyVocabulary proxy provides manipulation of tag vocabularies.
- id
The ID not null
- Type:
UUID (read-only)
- name
The name field, which is a unique string identifying the entity. not null 2 <= length <= 100
- Type:
str (read-only)
- classmethod new(regspec: Registry | RegistryCatalog, *, name: str, tags: list[str] = [], autosync=True) Vocabulary[source]
Create a new vocabulary.
- Parameters:
- Returns:
the newly created vocabulary.
- Return type:
- proxy_schema = <stelar.client.proxy.schema.Schema object>
- tag_map
The ‘tag_map’ field
- Type:
Any|None (read-only)
- property tagspecs: TagSpecList
The tagspecs of all tags in this vocabulary
- class stelar.client.vocab.VocabularyCursor(client)[source]
Bases:
GenericCursor[Vocabulary]Implement CKAN cursor functionalities for Vocabulary.
N.B. Currently, this class is here as a placeholder and may eventually be removed.
stelar.client.wfapi module
stelar.client.workflows module
- class stelar.client.workflows.Workflow(registry: Registry, eid: str | UUID | None = None, entity=None)[source]
Bases:
PackageProxy,LicensedProxy- proxy_schema = <stelar.client.proxy.schema.Schema object>