1- from . .observe import Observer
1+ from learning_orchestra_client . observe .observe import Observer
22from learning_orchestra_client .util ._response_treat import ResponseTreat
33from learning_orchestra_client .util ._entity_reader import EntityReader
44import requests
@@ -21,13 +21,13 @@ def __init__(self, cluster_ip: str, api_path: str):
2121 self .__observer = Observer (self .__cluster_ip )
2222
2323 def create_explore_sync (self ,
24- name : str ,
25- model_name : str ,
26- parent_name : str ,
27- method_name : str ,
28- parameters : dict ,
29- description : str = "" ,
30- pretty_response : bool = False ) -> \
24+ name : str ,
25+ model_name : str ,
26+ parent_name : str ,
27+ method_name : str ,
28+ parameters : dict ,
29+ description : str = "" ,
30+ pretty_response : bool = False ) -> \
3131 Union [dict , str ]:
3232 """
3333 description: This method runs an evaluation about a model in sync mode
@@ -57,16 +57,17 @@ def create_explore_sync(self,
5757 return self .__response_treat .treatment (response , pretty_response )
5858
5959 def create_explore_async (self ,
60- name : str ,
61- model_name : str ,
62- parent_name : str ,
63- method_name : str ,
64- parameters : dict ,
65- description : str = "" ,
66- pretty_response : bool = False ) -> \
60+ name : str ,
61+ model_name : str ,
62+ parent_name : str ,
63+ method_name : str ,
64+ parameters : dict ,
65+ description : str = "" ,
66+ pretty_response : bool = False ) -> \
6767 Union [dict , str ]:
6868 """
69- description: This method runs an explore service about a model in async mode
69+ description: This method runs an explore service about a model in async
70+ mode
7071
7172 pretty_response: If true it returns a string, otherwise a dictionary.
7273 name: Is the name of the model that will be explored.
@@ -93,8 +94,8 @@ def create_explore_async(self,
9394 def search_all_explores (self , pretty_response : bool = False ) \
9495 -> Union [dict , str ]:
9596 """
96- description: This method retrieves all created explorations, i.e., it does
97- not retrieve the specific explore content.
97+ description: This method retrieves all created explorations, i.e., it
98+ does not retrieve the specific explore content.
9899
99100 pretty_response: If true it returns a string, otherwise a dictionary.
100101
@@ -110,9 +111,9 @@ def delete_explore(self, name: str, pretty_response=False) \
110111 description: This method is responsible for deleting an explore result.
111112 This delete operation is asynchronous, so it does not lock the caller
112113 until the deletion finished. Instead, it returns a JSON object with a
113- URL for a future use. The caller uses the wait method for delete checks. If a
114- dataset was used by another task (Ex. projection, histogram, pca, tune
115- and so forth), it cannot be deleted.
114+ URL for a future use. The caller uses the wait method for delete
115+ checks. If a dataset was used by another task (Ex. projection,
116+ histogram, tune and so forth), it cannot be deleted.
116117
117118 pretty_response: If true it returns a string, otherwise a dictionary.
118119 name: Represents the model name.
@@ -127,17 +128,17 @@ def delete_explore(self, name: str, pretty_response=False) \
127128 return self .__response_treat .treatment (response , pretty_response )
128129
129130 def search_explore_image (self ,
130- name : str ,
131- pretty_response : bool = False ) \
131+ name : str ,
132+ pretty_response : bool = False ) \
132133 -> Union [dict , str ]:
133134 """
134135 description: This method is responsible for retrieving the explore
135136 image to be plotted
136137
137138 pretty_response: If true it returns a string, otherwise a dictionary.
138- name: Is the name of the model .
139+ name: Is the name of the explore instance .
139140
140- return An URL with a link for an image or an error if there
141+ return: An URL with a link for an image or an error if there
141142 is no such result.
142143 """
143144
@@ -146,16 +147,37 @@ def search_explore_image(self,
146147
147148 return self .__response_treat .treatment (response , pretty_response )
148149
149- def wait (self , name : str , timeout : str ) -> dict :
150+ def search_explore_metadata (self ,
151+ name : str ,
152+ pretty_response : bool = False ) \
153+ -> Union [dict , str ]:
154+ """
155+ description: This method is responsible for retrieving the explore
156+ metadata image.
157+
158+ pretty_response: If true it returns a string, otherwise a dictionary.
159+ name: Is the name of the explore instance.
160+
161+ return: A page with some metadata inside or an error if there
162+ is no such dataset. The current page is also returned to be used in
163+ future content requests.
164+ """
165+
166+ response = self .__entity_reader .read_explore_image_metadata (name )
167+
168+ return self .__response_treat .treatment (response , pretty_response )
169+
170+ def wait (self , name : str , timeout : int = None ) -> dict :
150171 """
151- description: This method is responsible to create a synchronization
152- barrier for the create_explore_async method, delete_explore_async method.
172+ description: This method is responsible to create a synchronization
173+ barrier for the create_explore_async method, delete_explore_async
174+ method.
153175
154- name: Represents the model name.
155- timeout: Represents the time in seconds to wait for an explore to finish its run. The -1 value
156- waits until the explore finishes .
176+ name: Represents the model name.
177+ timeout: Represents the time in seconds to wait for an explore to
178+ finish its run .
157179
158- return: JSON object with an error message, a warning message or a
159- correct explore result (the image URL as an explore result)
180+ return: JSON object with an error message, a warning message or a
181+ correct explore result (the image URL as an explore result)
160182 """
161183 return self .__observer .wait (name , timeout )
0 commit comments