Is your feature request related to a problem? Please describe.
Sometimes, it is required to check if a pipeline already exists.
In the Python-API, there is the function pipeline.get_info() which calls the endpoint
/v1/textanalysis/projects/{project}/pipelines/{pipeline}. If the pipeline exists, this returns some information about the pipeline. If it does not exists, it returns:
Exception: Unable to perform request: No pipeline named 'my_pipeline_name' exists in project 'my_project_name'.
Currently, some people used a try: ... except: ... block to use this information to conclude if the pipeline exists.This is obviously suboptimal, because it does not allow to differentiate between a 404-error (not found) and other kind of errors (e.g. 401-not authorized).
Describe the solution you'd like
I want to have a pipeline function pipeline.exists() that can be used for that purpose
We could implement it in the following way (TO BE DISCUSSED): When handling the errors in the function __handle_error(response) , we could issue a new Exception type NotFoundException for 404-errors. In the new pipeline.exists() method, we would then
return True, if pipeline.get_info() returned some valid information
return False, if pipeline.get_info() triggers an NotFoundException
Raise the exception for all other exceptions
Describe alternatives you've considered
The alternative is to wait for a new endpoint in the product which is a blocker.
Is your feature request related to a problem? Please describe. Sometimes, it is required to check if a pipeline already exists.
In the Python-API, there is the function pipeline.get_info() which calls the endpoint
/v1/textanalysis/projects/{project}/pipelines/{pipeline}
. If the pipeline exists, this returns some information about the pipeline. If it does not exists, it returns:Exception: Unable to perform request: No pipeline named 'my_pipeline_name' exists in project 'my_project_name'.
Currently, some people used a
try: ... except: ...
block to use this information to conclude if the pipeline exists.This is obviously suboptimal, because it does not allow to differentiate between a 404-error (not found) and other kind of errors (e.g. 401-not authorized).Describe the solution you'd like I want to have a pipeline function
pipeline.exists()
that can be used for that purposeWe could implement it in the following way (TO BE DISCUSSED): When handling the errors in the function
__handle_error(response)
, we could issue a new Exception typeNotFoundException
for 404-errors. In the newpipeline.exists()
method, we would thenTrue
, ifpipeline.get_info()
returned some valid informationFalse
, ifpipeline.get_info()
triggers an NotFoundExceptionDescribe alternatives you've considered The alternative is to wait for a new endpoint in the product which is a blocker.