Cuiman GUI Usage¶
The Cuiman GUI client extends the Python API client by adding dedicated GUI-widgets for specific features:
client.show(): execute a given process execution request,client.show_jobs(): show all jobs resulting from process execution,client.show_job(): show the details of a specific job.
Apart from that, they share the same interface. In the following, we visit all the features by example.
The client expects a running server that conforms to the OGC API - Process: Part 1, Version 1.0. If you don't have one available, you can also run the project's server with a test configuration:
wraptile run -- wraptile.services.local.testing:service
In [1]:
Copied!
from cuiman.gui import Client
from cuiman.gui import Client
In [2]:
Copied!
client = Client(api_url="http://localhost:8008/", auth_type="none")
#client
client = Client(api_url="http://localhost:8008/", auth_type="none")
#client
Select "Generate scene for testing":
In [3]:
Copied!
client.show()
client.show()
Out[3]:
In [4]:
Copied!
client.show_jobs()
client.show_jobs()
Out[4]:
In [5]:
Copied!
client.show_job("job_1")
client.show_job("job_1")
{
"detail": "Job 'job_1' does not exist",
"status": 404,
"title": "Not Found",
"type": "ApiError"
}
Custom TB Handler failed, unregistering
--------------------------------------------------------------------------- HTTPStatusError Traceback (most recent call last) File ~\Projects\eozilla\cuiman\src\cuiman\api\transport\httpx.py:110, in HttpxTransport._process_response(self, args, response) 109 try: --> 110 response.raise_for_status() 111 return args.get_response_for_status( 112 response.status_code, response_json, self.return_type_map 113 ) File ~\Projects\eozilla\.pixi\envs\default\Lib\site-packages\httpx\_models.py:829, in Response.raise_for_status(self) 828 message = message.format(self, error_type=error_type) --> 829 raise HTTPStatusError(message, request=request, response=self) HTTPStatusError: Client error '404 Not Found' for url 'http://localhost:8008/jobs/job_1' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 The above exception was the direct cause of the following exception: ClientError Traceback (most recent call last) Cell In[5], line 1 ----> 1 client.show_job("job_1") File ~\Projects\eozilla\cuiman\src\cuiman\gui\client.py:92, in Client.show_job(self, job_id) 91 if job_info is None: ---> 92 job_info = self.get_job(job_id) 93 job_info_panel = JobInfoPanelView(standalone=True) File ~\Projects\eozilla\cuiman\src\cuiman\api\client.py:311, in Client.get_job(self, job_id, **kwargs) 289 """ 290 Show the status of a job. 291 (...) 309 - `500`: A server error occurred. 310 """ --> 311 return self._transport.call( 312 TransportArgs( 313 path="/jobs/{jobId}", 314 method="get", 315 path_params={"jobId": job_id}, 316 return_types={"200": JobInfo}, 317 error_types={"404": ApiError, "500": ApiError}, 318 extra_kwargs=kwargs, 319 ) 320 ) File ~\Projects\eozilla\cuiman\src\cuiman\api\transport\httpx.py:50, in HttpxTransport.call(self, args) 49 response = self._sync_request(args) ---> 50 return self._process_response(args, response) File ~\Projects\eozilla\cuiman\src\cuiman\api\transport\httpx.py:115, in HttpxTransport._process_response(self, args, response) 114 except httpx.HTTPError as e: --> 115 raise args.get_exception_for_status( 116 response.status_code, f"{e}", response_json 117 ) from e ClientError: Client error '404 Not Found' for url 'http://localhost:8008/jobs/job_1' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 (status 404) During handling of the above exception, another exception occurred: TypeError Traceback (most recent call last) TypeError: not all arguments converted during string formatting The original exception:
In [ ]:
Copied!
ds = client.open_job_result("job_1")
ds
ds = client.open_job_result("job_1")
ds
In [ ]:
Copied!