Conditions#
- class saagieapi.SaagieApi(url_saagie: str, id_platform: str, user: str, password: str, realm: str, retries: int = 0, pprint_global: bool = False)#
Bases:
object
Define 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"] ... ) { "data": { "conditionPipelineCountFilteredLogs": 4 } }
- get_condition_instance_logs_by_condition(condition_id: str, project_id: str, pipeline_instance_id: str, streams: List[str], limit: int = None, skip: int = None) Dict #
Get logs for a condition on Environment Variable of a pipeline instance
- Parameters:
condition_id (str) – UUID of the condition
project_id (str) – UUID of the project
str (pipeline_instance_id !) – UUID of the pipeline instance
streams (List[str]) – List of logs files name to see (example : STDERR, STDOUT)
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_condition( ... condition_id="condition_node_id", ... project_id="project_id", ... pipeline_instance_id="pipeline_instance_id", ... streams=["STDOUT"] ... ) { "data": { "conditionPipelineByNodeIdFilteredLogs": { "count": 4, "content": [ { "index": 0, "value": "2023/05/15 12:55:19 INFO [evaluate_condition] Condition: 'tube_name.contains("Tube") ||", "stream": "STDOUT" }, { "index": 1, "value": "double(diameter) > 1.0'", "stream": "STDOUT" }, { "index": 2, "value": "2023/05/15 12:55:19 INFO [evaluate_condition] Condition evaluation took: 4.736725ms", "stream": "STDOUT" }, { "index": 3, "value": "2023/05/15 12:55:19 INFO [evaluate_condition] Result: true", "stream": "STDOUT" } ] } } }
- 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 : STDERR, STDOUT)
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" ... ) { "data": { "conditionPipelineByNodeIdFilteredLogs": { "count": 4, "content": [ { "index": 0, "value": "2023/05/15 12:55:19 INFO [evaluate_condition] Condition: 'tube_name.contains("Tube") ||", "stream": "STDOUT" }, { "index": 1, "value": "double(diameter) > 1.0'", "stream": "STDOUT" }, { "index": 2, "value": "2023/05/15 12:55:19 INFO [evaluate_condition] Condition evaluation took: 4.736725ms", "stream": "STDOUT" }, { "index": 3, "value": "2023/05/15 12:55:19 INFO [evaluate_condition] Result: true", "stream": "STDOUT" } ] } } }