Project methods
The Project object comes with three sets of methods: CRUD methods, entity specific CRUD methods and project specific methods.
CRUD methods
Crud methods are used to interact with the entity object in the backend or locally.
save(): Save or update the entity into the backend.export(): Export the entity locally as yaml file.refresh(): Refresh (read) the entity from the backend.
save
Save entity into backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
update
|
bool
|
If True, the object will be updated. |
False
|
Returns:
| Type | Description |
|---|---|
Project
|
Entity saved. |
export
Export object as a YAML file in the context folder. If the objects are not embedded, the objects are exported as a YAML file.
Returns:
| Type | Description |
|---|---|
str
|
Exported filepath. |
refresh
Refresh object from backend.
Returns:
| Type | Description |
|---|---|
Project
|
Project object. |
Entity CRUD
The project acts as context for other entities as mentioned in the introduction. With a Project object, you can create, read, update and delete these entities. The methods exposed are basically the same as the standalone CRUD functions; the only difference is that on the project object you omit the project name parameter. The available methods are:
new: create a new entitylog: create and upload an entityget: get an entity from backendget_versions: get all version for a named entitylist: list entities related to the projectimport: import an entityupdate: update an entitydelete: delete an entity
For more information about the entity methods, see the related entity documentation:
Project specific methods
The project object exposes the following methods:
run: execute a workflow from the projectsearch_entity: search entities related to the projectshare: share the project with a userunshare: remove project access for a user
run
Run workflow project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow
|
str
|
Workflow name. |
None
|
**kwargs
|
dict
|
Keyword arguments passed to workflow.run(). |
{}
|
Returns:
| Type | Description |
|---|---|
Run
|
Run instance. |
search_entity
Search objects from backend.
See also
digitalhub.search_entity
share
Share project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user
|
str
|
User to share project with. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
unshare
Unshare project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user
|
str
|
User to unshare project with. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|