Skip to content

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 entity
  • log: create and upload an entity
  • get: get an entity from backend
  • get_versions: get all version for a named entity
  • list: list entities related to the project
  • import: import an entity
  • update: update an entity
  • delete: 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 project
  • search_entity: search entities related to the project
  • share: share the project with a user
  • unshare: 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