peak-sdk 1.14.0__py3-none-any.whl → 1.15.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
peak/_metadata.py CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
2
+ # # Copyright © 2025 Peak AI Limited. or its affiliates. All Rights Reserved.
3
3
  # #
4
4
  # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
5
  # # may not use this file except in compliance with the License. A copy of
@@ -959,6 +959,9 @@ command_metadata: Dict[str, Any] = {
959
959
  "deployments>patch-parameters": {
960
960
  "request_body_yaml_path": "sample_yaml/press/patch_parameters.yaml",
961
961
  },
962
+ "deployments>patch-parameters-v2": {
963
+ "request_body_yaml_path": "sample_yaml/press/deployments/patch_app_parameters_v2.yaml",
964
+ },
962
965
  "metrics>publish": {
963
966
  "request_body_yaml_path": "sample_yaml/metrics/publish.yaml",
964
967
  },
peak/_version.py CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
2
+ # # Copyright © 2025 Peak AI Limited. or its affiliates. All Rights Reserved.
3
3
  # #
4
4
  # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
5
  # # may not use this file except in compliance with the License. A copy of
@@ -18,4 +18,4 @@
18
18
  # # You should have received a copy of the APACHE LICENSE, VERSION 2.0
19
19
  # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
20
  #
21
- __version__: str = "1.14.0"
21
+ __version__: str = "1.15.1"
@@ -1,5 +1,5 @@
1
1
  #
2
- # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
2
+ # # Copyright © 2025 Peak AI Limited. or its affiliates. All Rights Reserved.
3
3
  # #
4
4
  # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
5
  # # may not use this file except in compliance with the License. A copy of
@@ -19,6 +19,7 @@
19
19
  # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
20
  #
21
21
  """Peak apps specs commands."""
22
+
22
23
  from typing import Dict, List, Optional
23
24
 
24
25
  import typer
@@ -86,6 +87,12 @@ def create(
86
87
  title (string | required: false): Title of the parameter.
87
88
  options (list(str) | required: false): List of options for the parameter. If provided, it must have at least one object with "title" and "value" field.
88
89
  hideValue(boolean | required: false): Can be optionally provided to parameters of type "string", to mask the parameter's value when it has been set at deployment time.
90
+ conditions(list(map) | required: false): Conditions that determine when the parameter should be enabled. Conditions on two or more parameters should be used with conditionType "AND" or "OR".
91
+ - dependsOn (string): Name of the parameter that this parameter depends on.
92
+ operator (string): Operator to be used for the condition. Should be one of "equals" or "not-equals".
93
+ value (string): Value to be compared with the parameter.
94
+ - conditionType (string): Type of the condition. Should be one of "AND" or "OR".
95
+ conditions (list(map)): Nested conditions that determine when the parameter should be enabled.
89
96
  ```
90
97
 
91
98
  \b
@@ -352,6 +359,12 @@ def create_release(
352
359
  title (string | required: false): Title of the parameter.
353
360
  options (list(str) | required: false): List of options for the parameter. If provided, it must have at least one object with "title" and "value" field.
354
361
  hideValue(boolean | required: false): Can be optionally provided to parameters of type "string", to mask the parameter's value when it has been set at deployment time.
362
+ conditions(list(map) | required: false): Conditions that determine when the parameter should be enabled. Conditions on two or more parameters should be used with conditionType "AND" or "OR".
363
+ - dependsOn (string): Name of the parameter that this parameter depends on.
364
+ operator (string): Operator to be used for the condition. Should be one of "equals" or "not-equals".
365
+ value (string): Value to be compared with the parameter.
366
+ - conditionType (string): Type of the condition. Should be one of "AND" or "OR".
367
+ conditions (list(map)): Nested conditions that determine when the parameter should be enabled.
355
368
  ```
356
369
 
357
370
  \b
@@ -1,5 +1,5 @@
1
1
  #
2
- # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
2
+ # # Copyright © 2025 Peak AI Limited. or its affiliates. All Rights Reserved.
3
3
  # #
4
4
  # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
5
  # # may not use this file except in compliance with the License. A copy of
@@ -344,6 +344,12 @@ def create(
344
344
  title (string | required: false): Title of the parameter.
345
345
  options (list(str) | required: false): List of options for the parameter. If provided, it must have at least one object with "title" and "value" field.
346
346
  hideValue(boolean | required: false): Can be optionally provided to parameters of type "string", to mask the parameter's value when it has been set at deployment time.
347
+ conditions(list(map) | required: false): Conditions that determine when the parameter should be enabled. Conditions on two or more parameters should be used with conditionType "AND" or "OR".
348
+ - dependsOn (string): Name of the parameter that this parameter depends on.
349
+ operator (string): Operator to be used for the condition. Should be one of "equals" or "not-equals".
350
+ value (string): Value to be compared with the parameter.
351
+ - conditionType (string): Type of the condition. Should be one of "AND" or "OR".
352
+ conditions (list(map)): Nested conditions that determine when the parameter should be enabled.
347
353
  artifact (map | required: false):
348
354
  path (str): Path to the artifact.
349
355
  ignore_files (list(str) | required: false) : Ignore files to use when creating artifact.
@@ -762,6 +768,12 @@ def create_release(
762
768
  defaultValue (string | required: false): Default value of the parameter.
763
769
  title (string | required: false): Title of the parameter.
764
770
  options (list(str) | required: false): List of options for the parameter. If provided, it must have at least one object with "title" and "value" field.
771
+ conditions(list(map) | required: false): Conditions that determine when the parameter should be enabled. Conditions on two or more parameters should be used with conditionType "AND" or "OR".
772
+ - dependsOn (string): Name of the parameter that this parameter depends on.
773
+ operator (string): Operator to be used for the condition. Should be one of "equals" or "not-equals".
774
+ value (string): Value to be compared with the parameter.
775
+ - conditionType (string): Type of the condition. Should be one of "AND" or "OR".
776
+ conditions (list(map)): Nested conditions that determine when the parameter should be enabled.
765
777
  artifact (map | required: false):
766
778
  path (str): Path to the artifact.
767
779
  ignore_files (list(str) | required: false) : Ignore files to use when creating artifact.
@@ -1,5 +1,5 @@
1
1
  #
2
- # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
2
+ # # Copyright © 2025 Peak AI Limited. or its affiliates. All Rights Reserved.
3
3
  # #
4
4
  # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
5
  # # may not use this file except in compliance with the License. A copy of
@@ -127,7 +127,7 @@ def execute_resources(
127
127
  writer.write(response)
128
128
 
129
129
 
130
- @app.command(short_help="Update the parameters for a deployment at run time.")
130
+ @app.command(short_help="Update the runtime parameters for a deployment.")
131
131
  def patch_parameters(
132
132
  ctx: typer.Context,
133
133
  deployment_id: str = _DEPLOYMENT_ID,
@@ -169,3 +169,59 @@ def patch_parameters(
169
169
  with writer.pager():
170
170
  response = deployments_client.patch_parameters(deployment_id, **body)
171
171
  writer.write(response)
172
+
173
+
174
+ @app.command(short_help="Update the App runtime parameters and Block runtime parameters for a deployment.")
175
+ def patch_parameters_v2(
176
+ ctx: typer.Context,
177
+ deployment_id: str = _DEPLOYMENT_ID,
178
+ file: str = args.TEMPLATE_PATH,
179
+ params_file: Optional[str] = args.TEMPLATE_PARAMS_FILE,
180
+ params: Optional[List[str]] = args.TEMPLATE_PARAMS,
181
+ dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
182
+ paging: Optional[bool] = PAGING, # noqa: ARG001
183
+ output_type: Optional[OutputTypesNoTable] = OUTPUT_TYPES, # noqa: ARG001
184
+ generate: Optional[bool] = GENERATE_YAML, # noqa: ARG001
185
+ ) -> None:
186
+ """***Update*** the parameters for a deployment at runtime.
187
+
188
+ \b
189
+ 🧩 ***Input file schema to update run parameters of an app deployment (yaml):***<br/>
190
+ ```yaml
191
+ body (map):
192
+ appParameters (map | required: false):
193
+ Dictionary of runtime app parameters. Keys are parameter names, and values are the parameter values, which can be of type string, boolean, number, dictionary or list (string, number, dictionary).
194
+ parameters (map | required: false):
195
+ <blockName> (map): Dictionary of parameters specific to each block, where each key represents the block name.
196
+ Dictionary of runtime block parameters. Keys are parameter names, and values are the parameter values, which can be of type string, boolean, number, dictionary or list (string, number, dictionary).
197
+ ```
198
+
199
+ 🧩 ***Input file schema to update run parameters of a block deployment (yaml):***<br/>
200
+ ```yaml
201
+ body (map):
202
+ parameters (map | required: false):
203
+ Dictionary of runtime block parameters. Keys are parameter names, and values are the parameter values, which can be of type string, boolean, number, dictionary or list (string, number, dictionary).
204
+ ```
205
+
206
+ \b
207
+ 📝 ***Example usage:***
208
+ ```bash
209
+ peak deployments patch-parameters-v2 <deployment-id> /path/to/body.yaml -v /path/to/params.yaml
210
+ ```
211
+
212
+ \b
213
+ 🆗 ***Response:***
214
+ ```
215
+ { appParameters: {...}, parameters: {...} }
216
+ ```
217
+
218
+ 🔗 [**API Documentation**](https://press.peak.ai/api-docs/index.htm#/Deployment%20Parameters/patch_v2_deployments__deploymentId__parameters_run)
219
+ """
220
+ body = helpers.template_handler(file, params_file, params)
221
+ deployments_client: Deployment = ctx.obj["client"]
222
+ body = helpers.remove_unknown_args(body, deployments_client.patch_parameters_v2)
223
+ writer: Writer = ctx.obj["writer"]
224
+
225
+ with writer.pager():
226
+ response = deployments_client.patch_parameters_v2(deployment_id, **body)
227
+ writer.write(response)
peak/press/apps.py CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
2
+ # # Copyright © 2025 Peak AI Limited. or its affiliates. All Rights Reserved.
3
3
  # #
4
4
  # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
5
  # # may not use this file except in compliance with the License. A copy of
@@ -236,6 +236,25 @@ class App(BaseClient):
236
236
  "title": "string",
237
237
  "options": "list(str)",
238
238
  "hideValue": "boolean",
239
+ "conditions": [
240
+ // Basic condition
241
+ {
242
+ "dependsOn": "string",
243
+ "operator": "string",
244
+ "value": "string|number|boolean"
245
+ },
246
+ // Composite condition
247
+ {
248
+ "conditionType": "AND|OR",
249
+ "conditions": [
250
+ {
251
+ "dependsOn": "string",
252
+ "operator": "string",
253
+ "value": "string|number|boolean"
254
+ }
255
+ ]
256
+ }
257
+ ]
239
258
  }
240
259
  ]
241
260
  }
@@ -426,6 +445,25 @@ class App(BaseClient):
426
445
  "required": "boolean(required)",
427
446
  "title": "string",
428
447
  "type": "string(required)",
448
+ "conditions": [
449
+ // Basic condition
450
+ {
451
+ "dependsOn": "string",
452
+ "operator": "string",
453
+ "value": "string|number|boolean"
454
+ },
455
+ // Composite condition
456
+ {
457
+ "conditionType": "AND|OR",
458
+ "conditions": [
459
+ {
460
+ "dependsOn": "string",
461
+ "operator": "string",
462
+ "value": "string|number|boolean"
463
+ }
464
+ ]
465
+ }
466
+ ]
429
467
  }
430
468
  ]
431
469
  }
peak/press/blocks.py CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
2
+ # # Copyright © 2025 Peak AI Limited. or its affiliates. All Rights Reserved.
3
3
  # #
4
4
  # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
5
  # # may not use this file except in compliance with the License. A copy of
@@ -574,6 +574,25 @@ class Block(BaseClient):
574
574
  "required": "boolean(required)",
575
575
  "title": "string",
576
576
  "type": "string(required)",
577
+ "conditions": [
578
+ // Basic condition
579
+ {
580
+ "dependsOn": "string",
581
+ "operator": "equals|not-equals",
582
+ "value": "string|number|boolean"
583
+ },
584
+ // Composite condition
585
+ {
586
+ "conditionType": "AND|OR",
587
+ "conditions": [
588
+ {
589
+ "dependsOn": "string",
590
+ "operator": "equals|not-equals",
591
+ "value": "string|number|boolean"
592
+ }
593
+ ]
594
+ }
595
+ ]
577
596
  }
578
597
  ]
579
598
  }
@@ -1123,6 +1142,25 @@ class Block(BaseClient):
1123
1142
  "required": "boolean(required)",
1124
1143
  "title": "string",
1125
1144
  "type": "string(required)",
1145
+ "conditions": [
1146
+ // Basic condition
1147
+ {
1148
+ "dependsOn": "string",
1149
+ "operator": "equals|not-equals",
1150
+ "value": "string|number|boolean"
1151
+ },
1152
+ // Composite condition
1153
+ {
1154
+ "conditionType": "AND|OR",
1155
+ "conditions": [
1156
+ {
1157
+ "dependsOn": "string",
1158
+ "operator": "equals|not-equals",
1159
+ "value": "string|number|boolean"
1160
+ }
1161
+ ]
1162
+ }
1163
+ ]
1126
1164
  }
1127
1165
  ]
1128
1166
  }
peak/press/deployments.py CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
2
+ # # Copyright © 2025 Peak AI Limited. or its affiliates. All Rights Reserved.
3
3
  # #
4
4
  # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
5
  # # may not use this file except in compliance with the License. A copy of
@@ -188,6 +188,68 @@ class Deployment(BaseClient):
188
188
  subdomain="press",
189
189
  )
190
190
 
191
+ def patch_parameters_v2(
192
+ self,
193
+ deployment_id: str,
194
+ body: Dict[str, Any],
195
+ ) -> Dict[str, Any]:
196
+ """Get the runtime parameters for a deployment.
197
+
198
+ REFERENCE:
199
+ 🔗 `API Documentation <https://press.peak.ai/api-docs/index.htm#/Deployment%20Parameters/patch_v2_deployments__deploymentId__parameters_run>`__
200
+
201
+ Args:
202
+ deployment_id (str): The ID of the deployment.
203
+ body (Dict[str, Any]): body (Dict[str, str]): Dictionary of app and block parameters.
204
+
205
+ Returns:
206
+ Dict[str, Any]: Dictionary containing app and block parameters.
207
+
208
+ SCHEMA(Block Deployment Run Parameters):
209
+ The valid types for parameters are `boolean`, `string`, `string_array`, `number`, `number_array`, `object` and `object_array`.
210
+
211
+ .. code-block:: json
212
+
213
+ {
214
+ "parameters": {
215
+ "param_name": "param_value (string | number | boolean | dict | array)"
216
+ }
217
+ }
218
+
219
+ SCHEMA(App Deployment Run Parameters):
220
+ The valid types for parameters are `boolean`, `string`, `string_array`, `number`, `number_array`, `object` and `object_array`.
221
+
222
+ .. code-block:: json
223
+
224
+ {
225
+ "appParameters": {
226
+ "param_name": "param_value (string | number | boolean | dict | array)"
227
+ },
228
+ "parameters": {
229
+ "block_name": {
230
+ "param_name": "param_value (string | number | boolean | dict | array)"
231
+ }
232
+ }
233
+ }
234
+
235
+ Raises:
236
+ BadRequestException: The given parameters are invalid.
237
+ UnauthorizedException: The credentials are invalid.
238
+ ForbiddenException: The user does not have permission to perform the operation.
239
+ NotFoundException: The given deployment does not exist.
240
+ InternalServerErrorException: The server encountered an unexpected condition that
241
+ prevented it from fulfilling the request.
242
+ """
243
+ method, endpoint = HttpMethods.PATCH, f"v2/deployments/{deployment_id}/parameters/run"
244
+
245
+ return self.session.create_request( # type: ignore[no-any-return]
246
+ endpoint,
247
+ method,
248
+ body=body,
249
+ content_type=ContentType.APPLICATION_JSON,
250
+ subdomain="press",
251
+ )
252
+
191
253
 
192
254
  def get_client(session: Optional[Session] = None) -> Deployment:
193
255
  """Returns a Deployment client.
@@ -87,6 +87,37 @@ parameters:
87
87
  defaultValue:
88
88
  - input.csv
89
89
  - output.csv
90
+ - name: max_retries
91
+ type: number
92
+ required: false
93
+ title: Maximum Retries
94
+ description: Set maximum number of retry attempts
95
+ defaultValue: 3
96
+ - description: "specify the method to aggregate the data"
97
+ hideValue: true
98
+ required: true
99
+ title: "Aggregation Method"
100
+ name: "aggregation_method"
101
+ type: "string"
102
+ conditions:
103
+ - conditionType: "AND"
104
+ conditions:
105
+ - dependsOn: "max_retries"
106
+ operator: "equals"
107
+ value: 3
108
+ - dependsOn: "agg_type"
109
+ operator: "equals"
110
+ value: "AVG"
111
+ - description: "Specify the filtering criteria for data processing"
112
+ hideValue: true
113
+ required: true
114
+ title: "Filter Condition"
115
+ name: "filter_condition"
116
+ type: "string"
117
+ conditions:
118
+ - dependsOn: "max_retries"
119
+ operator: "equals"
120
+ value: 3
90
121
  featured: true
91
122
  scope: shared
92
123
  tenants:
@@ -76,3 +76,34 @@ parameters:
76
76
  defaultValue:
77
77
  - input.csv
78
78
  - output.csv
79
+ - name: max_retries
80
+ type: number
81
+ required: false
82
+ title: Maximum Retries
83
+ description: Set maximum number of retry attempts
84
+ defaultValue: 3
85
+ - description: "specify the method to aggregate the data"
86
+ hideValue: true
87
+ required: true
88
+ title: "Aggregation Method"
89
+ name: "aggregation_method"
90
+ type: "string"
91
+ conditions:
92
+ - conditionType: "AND"
93
+ conditions:
94
+ - dependsOn: "max_retries"
95
+ operator: "equals"
96
+ value: 3
97
+ - dependsOn: "agg_type"
98
+ operator: "equals"
99
+ value: "AVG"
100
+ - description: "Specify the filtering criteria for data processing"
101
+ hideValue: true
102
+ required: true
103
+ title: "Filter Condition"
104
+ name: "filter_condition"
105
+ type: "string"
106
+ conditions:
107
+ - dependsOn: "max_retries"
108
+ operator: "equals"
109
+ value: 3
@@ -90,6 +90,37 @@ parameters:
90
90
  defaultValue:
91
91
  - input.csv
92
92
  - output.csv
93
+ - name: max_retries
94
+ type: number
95
+ required: false
96
+ title: Maximum Retries
97
+ description: Set maximum number of retry attempts
98
+ defaultValue: 3
99
+ - description: "specify the method to aggregate the data"
100
+ hideValue: true
101
+ required: true
102
+ title: "Aggregation Method"
103
+ name: "aggregation_method"
104
+ type: "string"
105
+ conditions:
106
+ - conditionType: "AND"
107
+ conditions:
108
+ - dependsOn: "max_retries"
109
+ operator: "equals"
110
+ value: 3
111
+ - dependsOn: "agg_type"
112
+ operator: "equals"
113
+ value: "AVG"
114
+ - description: "Specify the filtering criteria for data processing"
115
+ hideValue: true
116
+ required: true
117
+ title: "Filter Condition"
118
+ name: "filter_condition"
119
+ type: "string"
120
+ conditions:
121
+ - dependsOn: "max_retries"
122
+ operator: "equals"
123
+ value: 3
93
124
  artifact:
94
125
  path: "."
95
126
  ignore_files:
@@ -81,6 +81,37 @@ parameters:
81
81
  defaultValue:
82
82
  - input.csv
83
83
  - output.csv
84
+ - name: max_retries
85
+ type: number
86
+ required: false
87
+ title: Maximum Retries
88
+ description: Set maximum number of retry attempts
89
+ defaultValue: 3
90
+ - description: "specify the method to aggregate the data"
91
+ hideValue: true
92
+ required: true
93
+ title: "Aggregation Method"
94
+ name: "aggregation_method"
95
+ type: "string"
96
+ conditions:
97
+ - conditionType: "AND"
98
+ conditions:
99
+ - dependsOn: "max_retries"
100
+ operator: "equals"
101
+ value: 3
102
+ - dependsOn: "agg_type"
103
+ operator: "equals"
104
+ value: "AVG"
105
+ - description: "Specify the filtering criteria for data processing"
106
+ hideValue: true
107
+ required: true
108
+ title: "Filter Condition"
109
+ name: "filter_condition"
110
+ type: "string"
111
+ conditions:
112
+ - dependsOn: "max_retries"
113
+ operator: "equals"
114
+ value: 3
84
115
  artifact:
85
116
  path: "."
86
117
  ignore_files:
@@ -92,6 +92,37 @@ parameters:
92
92
  defaultValue:
93
93
  - input.csv
94
94
  - output.csv
95
+ - name: max_retries
96
+ type: number
97
+ required: false
98
+ title: Maximum Retries
99
+ description: Set maximum number of retry attempts
100
+ defaultValue: 3
101
+ - description: "specify the method to aggregate the data"
102
+ hideValue: true
103
+ required: true
104
+ title: "Aggregation Method"
105
+ name: "aggregation_method"
106
+ type: "string"
107
+ conditions:
108
+ - conditionType: "AND"
109
+ conditions:
110
+ - dependsOn: "max_retries"
111
+ operator: "equals"
112
+ value: 3
113
+ - dependsOn: "agg_type"
114
+ operator: "equals"
115
+ value: "AVG"
116
+ - description: "Specify the filtering criteria for data processing"
117
+ hideValue: true
118
+ required: true
119
+ title: "Filter Condition"
120
+ name: "filter_condition"
121
+ type: "string"
122
+ conditions:
123
+ - dependsOn: "max_retries"
124
+ operator: "equals"
125
+ value: 3
95
126
  artifact:
96
127
  path: "."
97
128
  ignore_files:
@@ -83,6 +83,37 @@ parameters:
83
83
  defaultValue:
84
84
  - input.csv
85
85
  - output.csv
86
+ - name: max_retries
87
+ type: number
88
+ required: false
89
+ title: Maximum Retries
90
+ description: Set maximum number of retry attempts
91
+ defaultValue: 3
92
+ - description: "specify the method to aggregate the data"
93
+ hideValue: true
94
+ required: true
95
+ title: "Aggregation Method"
96
+ name: "aggregation_method"
97
+ type: "string"
98
+ conditions:
99
+ - conditionType: "AND"
100
+ conditions:
101
+ - dependsOn: "max_retries"
102
+ operator: "equals"
103
+ value: 3
104
+ - dependsOn: "agg_type"
105
+ operator: "equals"
106
+ value: "AVG"
107
+ - description: "Specify the filtering criteria for data processing"
108
+ hideValue: true
109
+ required: true
110
+ title: "Filter Condition"
111
+ name: "filter_condition"
112
+ type: "string"
113
+ conditions:
114
+ - dependsOn: "max_retries"
115
+ operator: "equals"
116
+ value: 3
86
117
  artifact:
87
118
  path: "."
88
119
  ignore_files:
@@ -172,6 +172,37 @@ parameters:
172
172
  defaultValue:
173
173
  - input.csv
174
174
  - output.csv
175
+ - name: max_retries
176
+ type: number
177
+ required: false
178
+ title: Maximum Retries
179
+ description: Set maximum number of retry attempts
180
+ defaultValue: 3
181
+ - description: "specify the method to aggregate the data"
182
+ hideValue: true
183
+ required: true
184
+ title: "Aggregation Method"
185
+ name: "aggregation_method"
186
+ type: "string"
187
+ conditions:
188
+ - conditionType: "AND"
189
+ conditions:
190
+ - dependsOn: "max_retries"
191
+ operator: "equals"
192
+ value: 3
193
+ - dependsOn: "agg_type"
194
+ operator: "equals"
195
+ value: "AVG"
196
+ - description: "Specify the filtering criteria for data processing"
197
+ hideValue: true
198
+ required: true
199
+ title: "Filter Condition"
200
+ name: "filter_condition"
201
+ type: "string"
202
+ conditions:
203
+ - dependsOn: "max_retries"
204
+ operator: "equals"
205
+ value: 3
175
206
  artifact:
176
207
  path: "."
177
208
  ignore_files:
@@ -161,6 +161,37 @@ parameters:
161
161
  defaultValue:
162
162
  - input.csv
163
163
  - output.csv
164
+ - name: max_retries
165
+ type: number
166
+ required: false
167
+ title: Maximum Retries
168
+ description: Set maximum number of retry attempts
169
+ defaultValue: 3
170
+ - description: "specify the method to aggregate the data"
171
+ hideValue: true
172
+ required: true
173
+ title: "Aggregation Method"
174
+ name: "aggregation_method"
175
+ type: "string"
176
+ conditions:
177
+ - conditionType: "AND"
178
+ conditions:
179
+ - dependsOn: "max_retries"
180
+ operator: "equals"
181
+ value: 3
182
+ - dependsOn: "agg_type"
183
+ operator: "equals"
184
+ value: "AVG"
185
+ - description: "Specify the filtering criteria for data processing"
186
+ hideValue: true
187
+ required: true
188
+ title: "Filter Condition"
189
+ name: "filter_condition"
190
+ type: "string"
191
+ conditions:
192
+ - dependsOn: "max_retries"
193
+ operator: "equals"
194
+ value: 3
164
195
  artifact:
165
196
  path: "."
166
197
  ignore_files:
@@ -0,0 +1,15 @@
1
+ # parameters.yaml
2
+
3
+ body:
4
+ appParameters:
5
+ agg_type: "MAX"
6
+ num_iterations: 50
7
+ email_notifications: true
8
+ file_names:
9
+ - input.csv
10
+ - output.csv
11
+ parameters:
12
+ block1:
13
+ email_notifications: false
14
+ block2:
15
+ num_iterations: 10
@@ -0,0 +1,10 @@
1
+ # parameters.yaml
2
+
3
+ body:
4
+ parameters:
5
+ agg_type: "MAX"
6
+ num_iterations: 50
7
+ email_notifications: true
8
+ file_names:
9
+ - input.csv
10
+ - output.csv
peak/session.py CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
2
+ # # Copyright © 2025 Peak AI Limited. or its affiliates. All Rights Reserved.
3
3
  # #
4
4
  # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
5
  # # may not use this file except in compliance with the License. A copy of
@@ -19,6 +19,7 @@
19
19
  # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
20
  #
21
21
  """Session module for Peak API."""
22
+
22
23
  from __future__ import annotations
23
24
 
24
25
  import os
@@ -243,7 +244,7 @@ class Session:
243
244
 
244
245
  logger.info("auth_token not given, searching for 'PEAK_AUTH_TOKEN' or 'API_KEY' in env variables")
245
246
  if not os.environ.get("API_KEY") and not os.environ.get("PEAK_AUTH_TOKEN"):
246
- raise exceptions.MissingEnvironmentVariableException(env_var="PEAK_AUTH_TOKEN or API_KEY")
247
+ raise exceptions.MissingEnvironmentVariableException(env_var="PEAK_AUTH_TOKEN")
247
248
  if os.environ.get("PEAK_AUTH_TOKEN"):
248
249
  self.auth_token = os.environ["PEAK_AUTH_TOKEN"]
249
250
  return
@@ -254,12 +255,9 @@ class Session:
254
255
  self.stage = Stage(stage)
255
256
  return
256
257
 
257
- logger.info("stage not given, searching for STAGE in env variables")
258
- if not os.environ.get("STAGE"):
259
- logger.info("STAGE environment variable is not set, defaulting to PROD")
260
- self.stage = Stage.PROD
261
- return
262
- self.stage = Stage(os.environ["STAGE"])
258
+ logger.info("stage not given, searching for PEAK__STAGE or STAGE in env variables")
259
+ final_stage = os.environ.get("PEAK__STAGE", os.environ.get("STAGE", Stage.PROD))
260
+ self.stage = Stage(final_stage)
263
261
 
264
262
 
265
263
  __all__: List[str] = ["Session", "_get_default_session"]
@@ -1,5 +1,5 @@
1
1
  #
2
- # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
2
+ # # Copyright © 2025 Peak AI Limited. or its affiliates. All Rights Reserved.
3
3
  # #
4
4
  # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
5
  # # may not use this file except in compliance with the License. A copy of
@@ -84,7 +84,7 @@ def peak_contexts_processor(
84
84
  "press_deployment_id": os.getenv("PRESS_DEPLOYMENT_ID"),
85
85
  "run_id": os.getenv("PEAK_RUN_ID"),
86
86
  "exec_id": os.getenv("PEAK_EXEC_ID"),
87
- "stage": os.getenv("STAGE"),
87
+ "stage": os.getenv("PEAK__STAGE", os.getenv("STAGE")),
88
88
  "tenant_name": os.getenv("TENANT_NAME", os.getenv("TENANT")),
89
89
  "tenant_id": os.getenv("TENANT_ID"),
90
90
  "api_name": os.getenv("PEAK_API_NAME"),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: peak-sdk
3
- Version: 1.14.0
3
+ Version: 1.15.1
4
4
  Summary: Python SDK for interacting with the Peak platform
5
5
  Home-page: https://docs.peak.ai/sdk/latest/
6
6
  License: Apache-2.0
@@ -106,7 +106,7 @@ Follow these steps to create a virtual environment using Python's built-in `venv
106
106
  This should return a response of the following format
107
107
 
108
108
  ```bash
109
- peak-cli==1.14.0
109
+ peak-cli==1.15.1
110
110
  Python==3.12.3
111
111
  System==Darwin(23.6.0)
112
112
  ```
@@ -122,14 +122,14 @@ Follow these steps to create a virtual environment using Python's built-in `venv
122
122
  This should print the version of the SDK
123
123
 
124
124
  ```
125
- 1.14.0
125
+ 1.15.1
126
126
  ```
127
127
 
128
128
  ### Using the SDK and CLI
129
129
 
130
- - To start using the SDK and CLI, you'll need either an API Key or a Personal Access Token (PAT).
131
- - If you don't have one yet, sign up for an account on the Peak platform to obtain your API key or Personal Access token (PAT).
132
- - To export it, run the following command in your terminal and replace <peak_auth_token> with your actual API key or PAT:
130
+ - To start using the SDK and CLI, you'll need a Personal Access Token (PAT).
131
+ - If you don't have one yet, sign up for an account on the Peak platform to obtain your Personal Access token (PAT).
132
+ - To export it, run the following command in your terminal and replace <peak_auth_token> with your actual PAT:
133
133
  ```
134
134
  export PEAK_AUTH_TOKEN=<peak_auth_token>
135
135
  ```
@@ -1,6 +1,6 @@
1
1
  peak/__init__.py,sha256=lxS3Xqyj9yvZdI3DVWbfn8i_Lw4t2Ujw9HbKe44-LY8,1284
2
- peak/_metadata.py,sha256=ongQ3I77xv-3nZSLemYk_UKYLiMAwfM60-K_vcqRMBI,30528
3
- peak/_version.py,sha256=q_w6UYjTZ96mhm0Vg6AXepEKgyu-XGfEAbNB40N3tlI,887
2
+ peak/_metadata.py,sha256=8w0pXN03pDvh1toM-divY6HNVF8znTqGGG2T9Q4hEl4,30672
3
+ peak/_version.py,sha256=QZinsq2WrQhSqLqmYU_Rte6hcEMNndD7qb28itNf9DA,887
4
4
  peak/auth.py,sha256=KcqCqovY6sFiMGNAGP9k3AtCAXrZ-tYd7QP-PFYorX0,904
5
5
  peak/base_client.py,sha256=3cS8hZApONkojwdgzt_tbwSxwpFcn3xGwzVcmxkgOJc,1808
6
6
  peak/callbacks.py,sha256=k_p2Av5_ZWD8bDzcSPhbYaAS2xHQpVI1cSkAecnmuqU,3775
@@ -13,11 +13,11 @@ peak/cli/metrics/metrics.py,sha256=ry8YIRhQccZhjqLO_nJOvBf7T-cUDYOSHlr92Jz63nM,2
13
13
  peak/cli/press/__init__.py,sha256=7zvL15sobpdrEuGoziADkJVnrHMiZKINYr4FDRFetY8,898
14
14
  peak/cli/press/apps/__init__.py,sha256=_bUtQG1zrO9Jv5zIFFKikR82-NsAfpow2KgSOa3oX_M,1459
15
15
  peak/cli/press/apps/deployments.py,sha256=t47FPfEOORXvb9_0F0cds0sxikMaNqOs-QEbsvebkl0,18737
16
- peak/cli/press/apps/specs.py,sha256=Nep1NHAWZ3M7MLMXAgXs77qkCtSBJxNo8KG_R0bW-MU,18236
16
+ peak/cli/press/apps/specs.py,sha256=9veK_CGrOUTpNEMIn1j-xrkcW8giY4E9LuQLpBuH8DQ,19635
17
17
  peak/cli/press/blocks/__init__.py,sha256=0kQIpLD29rlec5xTB9RLNPdIHxf6vi6_3gukBkwaySI,1499
18
18
  peak/cli/press/blocks/deployments.py,sha256=galqAK58qDvv4bpyL1z3cQ2YhxEu2msadoVXB4epOq0,21953
19
- peak/cli/press/blocks/specs.py,sha256=m_w8EFUiyTi36YOc0GZyKL6jdT9uEYi8uZf29y0HNvQ,62494
20
- peak/cli/press/deployments.py,sha256=xr46ZWwmOE9IIRb9U9zNSIfDN6_jAbQce-wvjgfm-VI,5902
19
+ peak/cli/press/blocks/specs.py,sha256=w-fuip1fgqa8NNPeSPl4MZMk-4SDJT6rhfBjxvPLlrM,63892
20
+ peak/cli/press/deployments.py,sha256=wdaxRHva59SdBB--gid19kekxTBv8qfnpI4UEXsIX1Q,8523
21
21
  peak/cli/press/specs.py,sha256=7XFWmgOuNBM8N482InvtQiZoQOldHqcQghLyHCmLHHI,4737
22
22
  peak/cli/resources/__init__.py,sha256=ThMYJ-QNULjTWOmAGUzhKWuqDcHq73DxzgTV2r5-uLs,883
23
23
  peak/cli/resources/alerts/__init__.py,sha256=TyeLPOGiA4qvOKORV3Ejlx8n6lGfX1G2GcU-bpYsgPE,1197
@@ -42,9 +42,9 @@ peak/metrics/__init__.py,sha256=g5ufdcpozE7C6jJVbzo9XQNK3o9dNTy31wgIaRBmrHQ,1057
42
42
  peak/metrics/metrics.py,sha256=oeexaJsy6CWiC6lwBPo6kWp_LXldkam1yKeO54ZbuP8,24533
43
43
  peak/output.py,sha256=J--61iDMLpBzXXV4BJu1eceT4W1lhiuYsYtGS1hEpOo,6971
44
44
  peak/press/__init__.py,sha256=80Key6wov_xZld45-39ELT0gDC_t4cy-JvA9wfCy7-c,1112
45
- peak/press/apps.py,sha256=EzNjAi337isk4EEprCEjGkvRyvkaZwu15nTwduLz8a0,48811
46
- peak/press/blocks.py,sha256=iY_aSX_7eTLm-rb3i6OXwngT6lb9qrZLjWtS5zIPl9A,95666
47
- peak/press/deployments.py,sha256=lfWSkrJ6nEWiA8bO0d5u675mGJakRgNuQEbqXpLgbJc,8487
45
+ peak/press/apps.py,sha256=Rh_EDQDuLyuM3FwFxz7riuq1i7lhU4uRclzp65KFPfE,50711
46
+ peak/press/blocks.py,sha256=9XLt2iiQBFa3ON9BddVZ1vp-kRNjij2JOfn069SAO-g,97610
47
+ peak/press/deployments.py,sha256=ZUcuUMygIEswGXleZAF8wkjzSXSl21jGERvIXJ__dcw,10969
48
48
  peak/press/specs.py,sha256=GH9-SACctAlcBZznXEmsIqneOwIJoE55mD4aHQymMrM,10915
49
49
  peak/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  peak/resources/__init__.py,sha256=CkLWMygz8mr_isA8uMGQn2uut-BilCydLwx5sYniPIA,1242
@@ -62,20 +62,22 @@ peak/sample_yaml/metrics/query.yaml,sha256=0RKgPjVvDxEHZcB9yj9sKan1vOiIw5_utRn68
62
62
  peak/sample_yaml/press/apps/deployments/create_app_deployment.yaml,sha256=rb8eICyd_tN5_gZAyuyZ7DqtThDWvAIqpSZmlwvBDUk,1254
63
63
  peak/sample_yaml/press/apps/deployments/create_app_deployment_revision.yaml,sha256=DwF9xn3lQIOMAlDsZl5V_6oiAN-0mfyADs4BsX56_KE,946
64
64
  peak/sample_yaml/press/apps/deployments/update_app_deployment_metadata.yaml,sha256=RBrAnxULPXYTrYY7T6l-L5_Q1E8LJ6RwVwOkw4zn5w0,302
65
- peak/sample_yaml/press/apps/specs/create_app_spec.yaml,sha256=pXzukt9A86DIg36a7SQDKExDNOLUxQPILBHxU3Ni1fk,2336
66
- peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml,sha256=lBy3ybY4DTiE9tFq0XIJCyYinSmqP0bx9XCh9tGHDKM,2001
65
+ peak/sample_yaml/press/apps/specs/create_app_spec.yaml,sha256=s7Wa8a3OEalt6oPc_dDcTXstF7x5PMZ8lBYuNMaFIX4,3263
66
+ peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml,sha256=8dI4n6LQfbi2LR_8IJOPe7NrMLdEoa2zHTbhemZGBCs,2928
67
67
  peak/sample_yaml/press/apps/specs/update_app_spec_metadata.yaml,sha256=jCZZevvQbeUlHtfhG0DZrNVMlzm-teT1dLs6DuqAloY,337
68
68
  peak/sample_yaml/press/blocks/deployments/create_block_deployment.yaml,sha256=LcJ2Eata1JdwQ8rhCM4kh2H0p5OsSpnGIMnVySP7DiY,729
69
69
  peak/sample_yaml/press/blocks/deployments/create_block_deployment_revision.yaml,sha256=ob17cSem5opvRaoeZzgwKtbTVItduNIHdnVD5l3nYuw,376
70
70
  peak/sample_yaml/press/blocks/deployments/patch_block_parameters.yaml,sha256=Zx8bHmrfnClykuUhBSe9OY9CBOwvfdtvxePLHED7LyA,156
71
71
  peak/sample_yaml/press/blocks/deployments/update_block_deployment_metadata.yaml,sha256=1Qvc-2kdxcC3wPpH8p4DQWFRNKqRMI_mQjeN4A0aUug,304
72
- peak/sample_yaml/press/blocks/specs/service/api/create_block_spec.yaml,sha256=WxwOG0w5sQHLzWPqvnlc3pJfc6XCw29sXgtgtxEa46g,2445
73
- peak/sample_yaml/press/blocks/specs/service/api/create_block_spec_release.yaml,sha256=kg0KjX9EBhB-0VD2SuBe7dMJPgOAhbc5kRsvd9xIpf8,2088
74
- peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec.yaml,sha256=srduheVqMfBjqvDfTFwU-5LDiHq-JcxCB0c-tfRLhho,2510
75
- peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec_release.yaml,sha256=vnCE4vXIeV_45QwXt1o_L4uxXVBk0NXwPzAG-B_s_fU,2138
72
+ peak/sample_yaml/press/blocks/specs/service/api/create_block_spec.yaml,sha256=S5pNty-8hq2XZ4E17gYqs3GyXwZzQXX_U9wyUNg2tSI,3372
73
+ peak/sample_yaml/press/blocks/specs/service/api/create_block_spec_release.yaml,sha256=n_fQCS095b6tch6dRtbDuVfdVvss-dk-lzXVOyAVXWc,3015
74
+ peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec.yaml,sha256=9qs86TLWq6HhSfZn23STYgaj3VekXyNjO-E94hAR5Fg,3437
75
+ peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec_release.yaml,sha256=lsjZ43P22XOraAgmISGmvX5J76uUbGhvRcfzV1lvIaY,3065
76
76
  peak/sample_yaml/press/blocks/specs/update_block_spec_metadata.yaml,sha256=WsfYGQ81gC4-RYG-U_N3_EPIhKjx4zOgg-tmAjmHkpk,378
77
- peak/sample_yaml/press/blocks/specs/workflow/create_block_spec.yaml,sha256=k4RePPB0wEiTwq91Lg2NY0MTTWr90zHPluxKsxAEpA4,4564
78
- peak/sample_yaml/press/blocks/specs/workflow/create_block_spec_release.yaml,sha256=70tGyUmrP-h_MweS7LzoYcltV8cNvBuDYxgexed7GxI,4208
77
+ peak/sample_yaml/press/blocks/specs/workflow/create_block_spec.yaml,sha256=yfV5dsF0vXIlS2hocCsyBev79opjDyYRnAGoVbDmnB4,5491
78
+ peak/sample_yaml/press/blocks/specs/workflow/create_block_spec_release.yaml,sha256=2M-hjRK1flbPItc4F7eHoCZwoDJoOCgVHtlEb6TSW4Y,5135
79
+ peak/sample_yaml/press/deployments/patch_app_parameters_v2.yaml,sha256=kP3dM8bd80HxmlLxJ8X0YKbcAkMLXNLGhk4Zjs0NcMw,264
80
+ peak/sample_yaml/press/deployments/patch_block_parameters_v2.yaml,sha256=pCkdChBMrcbAeuqVnOw4cAnqjptDNzWn--fcNOJMhIA,165
79
81
  peak/sample_yaml/press/patch_parameters.yaml,sha256=8eD8X2XNVQ9_TNDFXd-XPiZ5CK2upqpv1QCEiWvDGBs,139
80
82
  peak/sample_yaml/resources/artifacts/create_artifact.yaml,sha256=8sFU7VV2vv292THRsGNzTItWbhP7F4YMACM4jkVisRU,194
81
83
  peak/sample_yaml/resources/artifacts/create_artifact_version.yaml,sha256=Mru6TdS0z34--r4nhx0-ZBUgR6Ylj0Gp_JRy3-Kb7pk,131
@@ -110,18 +112,18 @@ peak/sample_yaml/resources/workflows/workflow_input_parameters.yaml,sha256=kM52m
110
112
  peak/sample_yaml/resources/workflows/workflow_input_parameters_inherit.yaml,sha256=6sA-CsVB0xS31G_2YE9W4vtZvupA9zDO97UCJKJlJiQ,1426
111
113
  peak/sample_yaml/resources/workflows/workflow_output_parameters.yaml,sha256=S9twG4lSB2HAt4ZL6zy5beKD-XY1Jik4asyHy4DG5Cs,913
112
114
  peak/sample_yaml/resources/workflows/workflow_skippable_steps.yaml,sha256=Ei1wGqJC-LqDPpQfqh_CmMmJ_DI5kQfuGTK4koQsiVk,1418
113
- peak/session.py,sha256=4Wi6uBmJSv6vAV0d6SweZCV59jpMr3Zkc-84aUTrn7U,10360
115
+ peak/session.py,sha256=mEK8nV_zyLp720ANTxvMyYI6BnM3ijrnQ4_4SZomP9A,10266
114
116
  peak/telemetry.py,sha256=LSrqSir-2WKPDwhjs_hG-oSjSIVnojptN124hPPR5i0,7263
115
117
  peak/template.py,sha256=VezqlvPxJKW_e4lh3GqsUX1mjUJsW9WRGLC1oMK2UwE,10839
116
118
  peak/tools/__init__.py,sha256=qK30qBi0MNvob6UkyzcfhI0s8nfSwGC4167A_2URBnY,1048
117
119
  peak/tools/logging/__init__.py,sha256=tIKis2HbtFzXY9gEsjcFipHxoGbieDtV2cYKP7Z9Ibw,1513
118
120
  peak/tools/logging/log_handler.py,sha256=wxU7klDyhCSdiotPnTXCvLhpRes_bnbQ3H1xVn42qjk,1406
119
121
  peak/tools/logging/log_level.py,sha256=Xtv4zZnYk4QBix_MfCRGim4yJbv7w2tTbNKe_s4QmaI,2665
120
- peak/tools/logging/logger.py,sha256=Jow5D3hqek-n0kHWNeL2nKbC9NfpfkWFT_FmPp-skTw,15653
122
+ peak/tools/logging/logger.py,sha256=5wvQwgwWrHllOmEl_O6q5Obv1-Eb2cW1deXtR8h_IqQ,15679
121
123
  peak/tools/logging/utils.py,sha256=qmjdBbCc1Y6JDbSgNXfdnLnpkx7fb9kPw9u8uO3AAII,3330
122
124
  peak/validators.py,sha256=_nVAXF_AB443voKNjyQsCTQBAVVAqn7xCbCbBguohIs,2715
123
- peak_sdk-1.14.0.dist-info/LICENSE,sha256=W0jszenKx7YdFA7BDnyg8xDKXzCP8AperJb_PHh9paQ,11340
124
- peak_sdk-1.14.0.dist-info/METADATA,sha256=7zHFOJ0bEqwu2_NEDS3jJ2ig9kJjDSw2Kv_IUHEdqv0,7978
125
- peak_sdk-1.14.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
126
- peak_sdk-1.14.0.dist-info/entry_points.txt,sha256=zHCEjuOTjkfmqivgEZQsPGm4zFA4W3Q_vKCjPr7W6lE,47
127
- peak_sdk-1.14.0.dist-info/RECORD,,
125
+ peak_sdk-1.15.1.dist-info/LICENSE,sha256=W0jszenKx7YdFA7BDnyg8xDKXzCP8AperJb_PHh9paQ,11340
126
+ peak_sdk-1.15.1.dist-info/METADATA,sha256=LEOJSOq_UBrq2Fm8k5OVudLkH_15MGgVtRoyaOSa5nw,7935
127
+ peak_sdk-1.15.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
128
+ peak_sdk-1.15.1.dist-info/entry_points.txt,sha256=zHCEjuOTjkfmqivgEZQsPGm4zFA4W3Q_vKCjPr7W6lE,47
129
+ peak_sdk-1.15.1.dist-info/RECORD,,