Conditions#
- class saagieapi.SaagieApi(url_saagie: str, id_platform: str, user: str, password: str, realm: str, retries: int = 0, pprint_global: bool = False, timeout: int = 10)#
Bases:
objectDefine several methods to interact with Saagie API in Python
- check_condition_expression(expression: str, project_id: str, variables: Dict = None) Dict#
Test the condition expression
- Parameters:
- Returns:
Dict of result of the condition expression
- Return type:
Dict
Examples
>>> saagieapi.check_condition_expression( ... expression="double(rmse) > 500.0", ... project_id="your_project_id", ... variables={"key": "rmse", "value": 300} ... ) { "data": { "evaluateConditionExpression": False } }
- count_condition_logs(condition_instance_id: str, project_id: str, streams: List[str]) Dict#
Get number of logs line for an instance of a condition on Environment Variable
- Parameters:
- Returns:
Dict of number of logs lines
- Return type:
Dic
Examples
>>> saagieapi.count_condition_logs( ... condition_instance_id="your_condition_instance_id", ... project_id="your_project_id", ... streams=["STDOUT"] ... )
- {
“logs”: [ ], “limit”: 1, “total”: 5, “order”: “asc”, “source”: “elastic”
}
- get_condition_instance_logs_by_instance(condition_instance_id: str, project_id: str, streams: List[str], limit: int = None, skip: int = None) Dict#
Get instance’s logs of a condition on Environment Variable
- Parameters:
condition_instance_id (str) – UUID of the condition instance
project_id (str) – UUID of the project
streams (List[str]) – List of logs files name to see (example : ENVVARS_STDOUT, ENVVARS_STDERR, ORCHESTRATION_STDOUT, ORCHESTRATION_STDERR, STDOUT, STDERR)
limit (int) – Number of logs lines to return from the beginning
skip (int) – Number of logs lines to doesn’t display from the beginning
- Returns:
Dict of logs lines
- Return type:
Examples
>>> saagieapi.get_condition_instance_logs_by_instance( ... condition_instance_id="condition_instance_id", ... project_id="project_id" ... ) { "logs": [ { "index": 0, "value": "2023/05/15 12:55:19 INFO [evaluate_condition] Condition: 'tube_name.contains("Tube") ||", "stream": "STDOUT" } ], "limit": 1, "total": 1, "order": "asc", "source": "elastic" }