ebonite.repository.metadata.local module¶
-
class
ebonite.repository.metadata.local.
LocalMetadataRepository
(path=None)[source]¶ Bases:
ebonite.repository.metadata.base.MetadataRepository
MetadataRepository
implementation which stores metadata in a local filesystem as JSON file.Warning: file storage is completely overwritten on each update, thus this repository is not suitable for high-performance scenarios.
Parameters: path – path to json with the metadata, if None metadata is stored in-memory. -
type
= 'local'¶
-
get_projects
() → List[ebonite.core.objects.core.Project][source]¶ Gets all projects in the repository
Returns: all projects in the repository
-
get_project_by_name
(name: str) → ebonite.core.objects.core.Project[source]¶ Finds project in the repository by name
Parameters: name – name of the project to return Returns: found project if exists or None
-
get_project_by_id
(id) → ebonite.core.objects.core.Project[source]¶ Finds project in the repository by identifier
Parameters: id – project id Returns: found project if exists or None
-
create_project
(project: ebonite.core.objects.core.Project) → ebonite.core.objects.core.Project[source]¶ Creates the project and all its tasks.
Parameters: project – project to create Returns: created project Exception: errors.ExistingProjectError
if given project has the same name as existing one.
-
update_project
(project: ebonite.core.objects.core.Project) → ebonite.core.objects.core.Project[source]¶ Updates the project and all its tasks.
Parameters: project – project to update Returns: updated project Exception: errors.NonExistingProjectError
if given project doesn’t exist in the repository
-
delete_project
(project: ebonite.core.objects.core.Project)[source]¶ Deletes the project and all tasks.
Parameters: project – project to delete Returns: nothing Exception: errors.NonExistingProjectError
if given project doesn’t exist in the repository
-
get_tasks
(project: Union[int, str, core.Project]) → List[ebonite.core.objects.core.Task][source]¶ Gets a list of tasks for given project
Parameters: project – project to search for tasks in Returns: project tasks
-
get_task_by_name
(project: Union[int, str, core.Project], task_name: str) → Optional[ebonite.core.objects.core.Task][source]¶ Finds task with given name in given project
Parameters: - project – project to search for task in
- task_name – expected name of task
Returns: task if exists or None
-
get_task_by_id
(id) → ebonite.core.objects.core.Task[source]¶ Finds task with given id
Parameters: id – id of task to search for Returns: task if exists or None
-
create_task
(task: ebonite.core.objects.core.Task) → ebonite.core.objects.core.Task[source]¶ Creates task in a repository
Parameters: task – task to create Returns: created task Exception: errors.ExistingTaskError
if given task has the same name and project as existing one
-
update_task
(task: ebonite.core.objects.core.Task) → ebonite.core.objects.core.Task[source]¶ Updates task in a repository.
Parameters: task – task to update Returns: updated task Exception: errors.NonExistingTaskError
if given tasks doesn’t exist in the repository
-
delete_task
(task: ebonite.core.objects.core.Task)[source]¶ Deletes the task and all its models.
Parameters: task – task to delete Returns: nothing Exception: errors.NonExistingTaskError
if given tasks doesn’t exist in the repository
-
get_models
(task: Union[int, str, core.Task], project: Union[int, str, core.Project] = None) → List[ebonite.core.objects.core.Model][source]¶ Gets a list of models in given project and task
Parameters: - task – task to search for models in
- project – project to search for models in
Returns: found models
-
get_model_by_name
(model_name: str, task: Union[int, str, core.Task], project: Union[int, str, core.Project] = None) → Optional[ebonite.core.objects.core.Model][source]¶ Finds model by name in given task and project.
Parameters: - model_name – expected model name
- task – task to search for model in
- project – project to search for model in
Returns: found model if exists or None
-
get_model_by_id
(id) → ebonite.core.objects.core.Model[source]¶ Finds model by identifier.
Parameters: id – expected model id Returns: found model if exists or None
-
create_model
(model: ebonite.core.objects.core.Model) → ebonite.core.objects.core.Model[source]¶ Creates model in the repository
Parameters: model – model to create Returns: created model Exception: errors.ExistingModelError
if given model has the same name and task as existing one
-
update_model
(model: ebonite.core.objects.core.Model) → ebonite.core.objects.core.Model[source]¶ Updates model in the repository
Parameters: model – model to update Returns: updated model Exception: errors.NonExistingModelError
if given model doesn’t exist in the repository
-
delete_model
(model: ebonite.core.objects.core.Model)[source]¶ Deletes model from the repository
Parameters: model – model to delete Returns: nothing Exception: errors.NonExistingModelError
if given model doesn’t exist in the repository
-
get_pipelines
(task: Union[int, str, core.Task], project: Union[int, str, core.Project] = None) → List[ebonite.core.objects.core.Pipeline][source]¶ Gets a list of pipelines in given project and task
Parameters: - task – task to search for models in
- project – project to search for models in
Returns: found pipelines
-
get_pipeline_by_name
(pipeline_name: str, task: Union[int, str, core.Task], project: Union[int, str, core.Project] = None) → Optional[ebonite.core.objects.core.Pipeline][source]¶ Finds model by name in given task and project.
Parameters: - pipeline_name – expected pipeline name
- task – task to search for pipeline in
- project – project to search for pipeline in
Returns: found pipeline if exists or None
-
get_pipeline_by_id
(id) → ebonite.core.objects.core.Pipeline[source]¶ Finds model by identifier.
Parameters: id – expected model id Returns: found model if exists or None
-
create_pipeline
(pipeline: ebonite.core.objects.core.Pipeline) → ebonite.core.objects.core.Pipeline[source]¶ Creates model in the repository
Parameters: pipeline – pipeline to create Returns: created pipeline Exception: errors.ExistingPipelineError
if given model has the same name and task as existing one
-
update_pipeline
(pipeline: ebonite.core.objects.core.Pipeline) → ebonite.core.objects.core.Pipeline[source]¶ Updates model in the repository
Parameters: pipeline – pipeline to update Returns: updated model Exception: errors.NonExistingPipelineError
if given pipeline doesn’t exist in the repository
-
delete_pipeline
(pipeline: ebonite.core.objects.core.Pipeline)[source]¶ Deletes model from the repository
Parameters: pipeline – pipeline to delete Returns: nothing Exception: errors.NonExistingPipelineError
if given pipeline doesn’t exist in the repository
-
get_images
(task: Union[int, str, core.Task], project: Union[int, str, core.Project] = None) → List[ebonite.core.objects.core.Image][source]¶ Gets a list of images in given model, task and project
Parameters: - task – task to search for images in
- project – project to search for images in
Returns: found images
-
get_image_by_name
(image_name, task: Union[int, str, core.Task], project: Union[int, str, core.Project] = None) → Optional[ebonite.core.objects.core.Image][source]¶ Finds image by name in given model, task and project.
Parameters: - image_name – expected image name
- task – task to search for image in
- project – project to search for image in
Returns: found image if exists or None
-
get_image_by_id
(id: int) → Optional[ebonite.core.objects.core.Image][source]¶ Finds image by identifier.
Parameters: id – expected image id Returns: found image if exists or None
-
create_image
(image: ebonite.core.objects.core.Image) → ebonite.core.objects.core.Image[source]¶ Creates image in the repository
Parameters: image – image to create Returns: created image Exception: errors.ExistingImageError
if given image has the same name and model as existing one
-
update_image
(image: ebonite.core.objects.core.Image) → ebonite.core.objects.core.Image[source]¶ Updates image in the repository
Parameters: image – image to update Returns: updated image Exception: errors.NonExistingImageError
if given image doesn’t exist in the repository
-
delete_image
(image: ebonite.core.objects.core.Image)[source]¶ Deletes image from the repository
Parameters: image – image to delete Returns: nothing Exception: errors.NonExistingImageError
if given image doesn’t exist in the repository
-
get_environments
() → List[ebonite.core.objects.core.RuntimeEnvironment][source]¶ Gets a list of runtime environments
Returns: found runtime environments
-
get_environment_by_name
(name) → Optional[ebonite.core.objects.core.RuntimeEnvironment][source]¶ Finds runtime environment by name.
Parameters: name – expected runtime environment name Returns: found runtime environment if exists or None
-
get_environment_by_id
(id: int) → Optional[ebonite.core.objects.core.RuntimeEnvironment][source]¶ Finds runtime environment by identifier.
Parameters: id – expected runtime environment id Returns: found runtime environment if exists or None
-
create_environment
(environment: ebonite.core.objects.core.RuntimeEnvironment) → ebonite.core.objects.core.RuntimeEnvironment[source]¶ Creates runtime environment in the repository
Parameters: environment – runtime environment to create Returns: created runtime environment Exception: errors.ExistingEnvironmentError
if given runtime environment has the same name as existing
-
update_environment
(environment: ebonite.core.objects.core.RuntimeEnvironment) → ebonite.core.objects.core.RuntimeEnvironment[source]¶ Updates runtime environment in the repository
Parameters: environment – runtime environment to update Returns: updated runtime environment Exception: errors.NonExistingEnvironmentError
if given runtime environment doesn’t exist in therepository
-
delete_environment
(environment: ebonite.core.objects.core.RuntimeEnvironment)[source]¶ Deletes runtime environment from the repository
Parameters: environment – runtime environment to delete Returns: nothing Exception: errors.NonExistingEnvironmentError
if given runtime environment doesn’t exist in therepository
-
get_instances
(image: Union[int, ebonite.core.objects.core.Image] = None, environment: Union[int, ebonite.core.objects.core.RuntimeEnvironment] = None) → List[ebonite.core.objects.core.RuntimeInstance][source]¶ Gets a list of instances in given image or environment
Parameters: - image – image (or id) to search for instances in
- environment – environment (or id) to search for instances in
Returns: found instances
-
get_instance_by_name
(instance_name, image: Union[int, ebonite.core.objects.core.Image], environment: Union[int, ebonite.core.objects.core.RuntimeEnvironment]) → Optional[ebonite.core.objects.core.RuntimeInstance][source]¶ Finds instance by name in given image and environment.
Parameters: - instance_name – expected instance name
- image – image (or id) to search for instance in
- environment – environment (or id) to search for instance in
Returns: found instance if exists or None
-
get_instance_by_id
(id: int) → Optional[ebonite.core.objects.core.RuntimeInstance][source]¶ Finds instance by identifier.
Parameters: id – expected instance id Returns: found instance if exists or None
-
create_instance
(instance: ebonite.core.objects.core.RuntimeInstance) → ebonite.core.objects.core.RuntimeInstance[source]¶ Creates instance in the repository
Parameters: instance – instance to create Returns: created instance Exception: errors.ExistingInstanceError
if given instance has the same name, image and environment as existing one
-
update_instance
(instance: ebonite.core.objects.core.RuntimeInstance) → ebonite.core.objects.core.RuntimeInstance[source]¶ Updates instance in the repository
Parameters: instance – instance to update Returns: updated instance Exception: errors.NonExistingInstanceError
if given instance doesn’t exist in the repository
-
delete_instance
(instance: ebonite.core.objects.core.RuntimeInstance)[source]¶ Deletes instance from the repository
Parameters: instance – instance to delete Returns: nothing Exception: errors.NonExistingInstanceError
if given instance doesn’t exist in the repository
-