citrine.resources.project module
Resources that represent both individual and collections of projects.
- class citrine.resources.project.Project(name: str, *, description: str | None = None, session: Session | None = None, team_id: UUID | None = None)
Bases:
Resource
[Project
]A Citrine Project.
A project is a collection of datasets and AI assets, some of which belong directly to the project, and some of which have been shared with the project.
- Parameters:
name (str) – Name of the project.
description (str) – Long-form description of the project.
session (Session, optional) – The Citrine session used to connect to the database.
- access_control_dict() dict
Return an access control entity representation of this resource. Internal use only.
- classmethod build(data: dict) Self
Build an instance of this object from given data.
- dump() dict
Dump this instance.
- gemd_batch_delete(id_list: List[LinkByUID | UUID | str | BaseEntity], *, timeout: float = 120, polling_delay: float = 1.0) List[Tuple[LinkByUID, ApiError]]
Remove a set of GEMD objects.
You may provide GEMD objects that reference each other, and the objects will be removed in the appropriate order.
A failure will be returned if the object cannot be deleted due to an external reference.
You must have Write access on the associated datasets for each object.
- Parameters:
id_list (List[Union[LinkByUID, UUID, str, BaseEntity]]) – A list of the IDs of data objects to be removed. They can be passed as a LinkByUID tuple, a UUID, a string, or the object itself. A UUID or string is assumed to be a Citrine ID, whereas a LinkByUID or BaseEntity can also be used to provide an external ID.
timeout (float) – Amount of time to wait on the job (in seconds) before giving up. Defaults to 2 minutes. Note that this number has no effect on the underlying job itself, which can also time out server-side.
polling_delay (float) – How long to delay between each polling retry attempt (in seconds).
- Returns:
A list of (LinkByUID, api_error) for each failure to delete an object. Note that this method doesn’t raise an exception if an object fails to be deleted.
- Return type:
List[Tuple[LinkByUID, ApiError]]
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.gemd_batch_delete’ instead.’
- classmethod get_team_id_from_project_id(session: Session, project_id: UUID)
Returns the UUID of the Team that owns the project with the provided project_id.
- list_members() List[ProjectMember] | List[TeamMember]
List all of the members in the current project.
- Returns:
The members of the current project, or the members of the team containing the project if teams have been released.
- Return type:
List[ProjectMember] | List[TeamMember]
- owned_dataset_ids() List[str]
List all the ids of the datasets owned by the current project.
- Returns:
The ids of the modules owned by current project
- Return type:
List[str]
- publish(*, resource: Resource)
Publish a resource from a project to its encompassing team.
In order to use the Resource in a different project, you should use project.pull_in_resource() to pull that resource into the other project.
- Parameters:
resource (Resource) – The resource owned by this project, which will be published
- Returns:
Returns
True
if resource successfully published- Return type:
bool
- pull_in_resource(*, resource: Resource)
Pull in a public resource from this project’s team.
- Parameters:
resource (Resource) – The resource owned by the encompassing team, which will be pulled in
- Returns:
Returns
True
if resource successfully pulled in- Return type:
bool
- un_publish(*, resource: Resource)
Un-publish a resource from a project from its encompassing team.
- Parameters:
resource (Resource) – The resource owned by this project, which will be un-published
- Returns:
Returns
True
if resource successfully un-published- Return type:
bool
- property branches: BranchCollection
Return a resource representing all visible branches.
- property condition_templates: ConditionTemplateCollection
Return a resource representing all condition templates in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.condition_templates’ instead.’
- created_at = None
Time the project was created, in seconds since epoch.
- Type:
int
- property datasets: DatasetCollection
Return a resource representing all visible datasets.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.datasets’ instead.’
- description: str | None = None
- property descriptors: DescriptorMethods
Return a resource containing a set of methods returning descriptors.
- property design_spaces: DesignSpaceCollection
Return a resource representing all visible design spaces.
- property design_workflows: DesignWorkflowCollection
Return a collection representing all visible design workflows.
- property gemd: GEMDResourceCollection
Return a resource representing all GEMD objects/templates in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.gemd’ instead.’
- property generative_design_executions: GenerativeDesignExecutionCollection
Return a collection representing all visible generative design executions.
- property ingredient_runs: IngredientRunCollection
Return a resource representing all ingredient runs in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.ingredient_runs’ instead.’
- property ingredient_specs: IngredientSpecCollection
Return a resource representing all ingredient specs in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.ingredient_specs’ instead.’
- property material_runs: MaterialRunCollection
Return a resource representing all material runs in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.material_runs’ instead.’
- property material_specs: MaterialSpecCollection
Return a resource representing all material specs in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.material_specs’ instead.’
- property material_templates: MaterialTemplateCollection
Return a resource representing all material templates in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.material_templates’ instead.’
- property measurement_runs: MeasurementRunCollection
Return a resource representing all measurement runs in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.measurement_runs’ instead.’
- property measurement_specs: MeasurementSpecCollection
Return a resource representing all measurement specs in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.measurement_specs’ instead.’
- property measurement_templates: MeasurementTemplateCollection
Return a resource representing all measurement templates in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.measurement_templates’ instead.’
- name: str = None
- property parameter_templates: ParameterTemplateCollection
Return a resource representing all parameter templates in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.parameter_templates’ instead.’
- property predictor_evaluation_executions: PredictorEvaluationExecutionCollection
Return a collection representing all visible predictor evaluation executions.
- property predictor_evaluation_workflows: PredictorEvaluationWorkflowCollection
Return a collection representing all visible predictor evaluation workflows.
- property predictors: PredictorCollection
Return a resource representing all visible predictors.
- property process_runs: ProcessRunCollection
Return a resource representing all process runs in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.process_runs’ instead.’
- property process_specs: ProcessSpecCollection
Return a resource representing all process specs in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.process_specs’ instead.’
- property process_templates: ProcessTemplateCollection
Return a resource representing all process templates in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.process_templates’ instead.’
- property property_templates: PropertyTemplateCollection
Return a resource representing all property templates in this dataset.
Deprecated since version 3.4.0: This will be removed in 4.0.0. Please use ‘Team.property_templates’ instead.’
- status = None
Status of the project.
- Type:
str
- property table_configs: TableConfigCollection
Return a resource representing all Table Configs in the project.
- property tables: GemTableCollection
Return a resource representing all visible Tables.
- property team_id
Returns the Team’s id-scoped UUID.
- uid = None
Unique uuid4 identifier of this project.
- Type:
UUID
- class citrine.resources.project.ProjectCollection(session: Session, *, team_id: UUID | None = None)
Bases:
Collection
[Project
]Represents the collection of all projects as well as the resources belonging to it.
- Parameters:
session (Session, optional) – The Citrine session used to connect to the database.
- build(data) Project
Build an individual project from a dictionary.
- Parameters:
data (dict) – A dictionary representing the project.
- Returns:
The project created from data.
- Return type:
- delete(uid: UUID | str) Response
Delete a particular project.
Only empty projects can be deleted. If the project is not empty, then the Response will contain a list of all of the project’s resources. These must be deleted before the project can be deleted.
- get(uid: UUID | str) ResourceType
Get a particular element of the collection.
- list(*, per_page: int = 1000) Iterator[Project]
List projects using pagination.
- Parameters:
per_page (int, optional) – Max number of results to return per page. Default is 1000. This parameter is used when making requests to the backend service. If the page parameter is specified it limits the maximum number of elements in the response.
- Returns:
Projects in this collection.
- Return type:
Iterator[Project]
- register(name: str, *, description: str | None = None) Project
Create and upload new project.
- Parameters:
name (str) – Name of the project to be created.
description (str) – Long-form description of the project to be created.
- search(*, search_params: dict | None = None, per_page: int = 1000) Iterable[Project]
Search for projects matching the desired name or description.
You can search for projects matching the desired name or description by either exact match or substring match, as specified by the search_params argument. Defaults to no search criteria.
Like
list
, this method allows for pagination. This differs from the list function, because it makes a POST request to resourceType/search with search fields in a post body.Leaving page and per_page as default values will yield all elements in the collection, paginating over all available pages.
Leaving
search_params
as its default value will return mimic the behavior of a full list with no search parameters.- Parameters:
search_params (dict, optional) –
A
dict
representing the body of the post request that will be sent to the search endpoint to filter the results, e.g.,{ "name": { "value": "Polymer Project", "search_method": "EXACT" }, "description": { "value": "polymer chain length", "search_method": "SUBSTRING" }, }
The
dict
can contain any combination of (one or all) search specifications for the name, description, and status fields of a project. For each parameter specified, the"value"
to match, as well as the"search_method"
must be provided. The availablesearch_methods
are"SUBSTRING"
and"EXACT"
. The example above demonstrates the input necessary to list projects with the exact name"Polymer Project"
and descriptions including the phrase"polymer chain length"
.per_page (int, optional) – Max number of results to return per page. Default is 100. This parameter is used when making requests to the backend service. If the page parameter is specified it limits the maximum number of elements in the response.
- Returns:
Projects in this collection.
- Return type:
Iterable[Project]
- search_all(search_params: Dict | None) Iterable[Dict]
Search across all projects in a domain.
There is no pagination on search_all.
This is compatible with accounts v3 only.
- Parameters:
search_params (dict, optional) –
A
dict
representing the body of the post request that will be sent to the search endpoint to filter the results, e.g.,{ "name": { "value": "Polymer Project", "search_method": "EXACT" }, "description": { "value": "polymer chain length", "search_method": "SUBSTRING" }, }
The
dict
can contain any combination of (one or all) search specifications for the name, description, and status fields of a project. For each parameter specified, the"value"
to match, as well as the"search_method"
must be provided. The availablesearch_methods
are"SUBSTRING"
and"EXACT"
. The example above demonstrates the input necessary to list projects with the exact name"Polymer Project"
and descriptions including the phrase"polymer chain length"
.- Returns:
Projects in this collection.
- Return type:
Iterable[Dict]