langfun 0.1.2.dev202510270805__py3-none-any.whl → 0.1.2.dev202510290805__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.

Potentially problematic release.


This version of langfun might be problematic. Click here for more details.

@@ -75,11 +75,11 @@ class EventLoggerTest(unittest.TestCase):
75
75
  )
76
76
  with self._capture_logs(test_name) as stream:
77
77
  with env:
78
- with env.sandbox('session1') as sb:
78
+ with env.sandbox(session_id='session1') as sb:
79
79
  self.assertEqual(sb.test_feature1.num_shell_calls(), 4)
80
80
 
81
81
  with self.assertRaises(interface.SandboxStateError):
82
- with env.sandbox('session2') as sb:
82
+ with env.sandbox(session_id='session2') as sb:
83
83
  sb.shell('echo "bar"', raise_error=RuntimeError)
84
84
 
85
85
  stdout = stream.getvalue()
@@ -100,6 +100,7 @@ class MetricWriter(pg.Object, base.EventHandler):
100
100
  parameters={
101
101
  'app': str,
102
102
  'environment_id': str,
103
+ 'image_id': str,
103
104
  'error': str,
104
105
  }
105
106
  )
@@ -109,6 +110,7 @@ class MetricWriter(pg.Object, base.EventHandler):
109
110
  parameters={
110
111
  'app': str,
111
112
  'environment_id': str,
113
+ 'image_id': str,
112
114
  'error': str
113
115
  }
114
116
  )
@@ -118,6 +120,7 @@ class MetricWriter(pg.Object, base.EventHandler):
118
120
  parameters={
119
121
  'app': str,
120
122
  'environment_id': str,
123
+ 'image_id': str,
121
124
  'status': str,
122
125
  },
123
126
  )
@@ -127,6 +130,7 @@ class MetricWriter(pg.Object, base.EventHandler):
127
130
  parameters={
128
131
  'app': str,
129
132
  'environment_id': str,
133
+ 'image_id': str,
130
134
  'error': str,
131
135
  }
132
136
  )
@@ -136,6 +140,7 @@ class MetricWriter(pg.Object, base.EventHandler):
136
140
  parameters={
137
141
  'app': str,
138
142
  'environment_id': str,
143
+ 'image_id': str,
139
144
  'activity': str,
140
145
  'error': str,
141
146
  }
@@ -148,6 +153,7 @@ class MetricWriter(pg.Object, base.EventHandler):
148
153
  parameters={
149
154
  'app': str,
150
155
  'environment_id': str,
156
+ 'image_id': str,
151
157
  'error': str,
152
158
  }
153
159
  )
@@ -157,6 +163,7 @@ class MetricWriter(pg.Object, base.EventHandler):
157
163
  parameters={
158
164
  'app': str,
159
165
  'environment_id': str,
166
+ 'image_id': str,
160
167
  'error': str,
161
168
  }
162
169
  )
@@ -166,6 +173,7 @@ class MetricWriter(pg.Object, base.EventHandler):
166
173
  parameters={
167
174
  'app': str,
168
175
  'environment_id': str,
176
+ 'image_id': str,
169
177
  'error': str,
170
178
  }
171
179
  )
@@ -175,6 +183,7 @@ class MetricWriter(pg.Object, base.EventHandler):
175
183
  parameters={
176
184
  'app': str,
177
185
  'environment_id': str,
186
+ 'image_id': str,
178
187
  'error': str,
179
188
  }
180
189
  )
@@ -184,6 +193,7 @@ class MetricWriter(pg.Object, base.EventHandler):
184
193
  parameters={
185
194
  'app': str,
186
195
  'environment_id': str,
196
+ 'image_id': str,
187
197
  'status': str,
188
198
  }
189
199
  )
@@ -193,6 +203,7 @@ class MetricWriter(pg.Object, base.EventHandler):
193
203
  parameters={
194
204
  'app': str,
195
205
  'environment_id': str,
206
+ 'image_id': str,
196
207
  'activity': str,
197
208
  'error': str,
198
209
  }
@@ -209,6 +220,7 @@ class MetricWriter(pg.Object, base.EventHandler):
209
220
  parameters={
210
221
  'app': str,
211
222
  'environment_id': str,
223
+ 'image_id': str,
212
224
  'feature_name': str,
213
225
  'error': str,
214
226
  }
@@ -219,6 +231,7 @@ class MetricWriter(pg.Object, base.EventHandler):
219
231
  parameters={
220
232
  'app': str,
221
233
  'environment_id': str,
234
+ 'image_id': str,
222
235
  'feature_name': str,
223
236
  'error': str,
224
237
  }
@@ -229,6 +242,7 @@ class MetricWriter(pg.Object, base.EventHandler):
229
242
  parameters={
230
243
  'app': str,
231
244
  'environment_id': str,
245
+ 'image_id': str,
232
246
  'feature_name': str,
233
247
  'error': str,
234
248
  }
@@ -239,6 +253,7 @@ class MetricWriter(pg.Object, base.EventHandler):
239
253
  parameters={
240
254
  'app': str,
241
255
  'environment_id': str,
256
+ 'image_id': str,
242
257
  'feature_name': str,
243
258
  'error': str,
244
259
  }
@@ -249,6 +264,7 @@ class MetricWriter(pg.Object, base.EventHandler):
249
264
  parameters={
250
265
  'app': str,
251
266
  'environment_id': str,
267
+ 'image_id': str,
252
268
  'feature_name': str,
253
269
  'error': str,
254
270
  }
@@ -261,6 +277,7 @@ class MetricWriter(pg.Object, base.EventHandler):
261
277
  parameters={
262
278
  'app': str,
263
279
  'environment_id': str,
280
+ 'image_id': str,
264
281
  'feature_name': str,
265
282
  'error': str,
266
283
  }
@@ -271,6 +288,7 @@ class MetricWriter(pg.Object, base.EventHandler):
271
288
  parameters={
272
289
  'app': str,
273
290
  'environment_id': str,
291
+ 'image_id': str,
274
292
  'feature_name': str,
275
293
  'error': str,
276
294
  }
@@ -281,6 +299,7 @@ class MetricWriter(pg.Object, base.EventHandler):
281
299
  parameters={
282
300
  'app': str,
283
301
  'environment_id': str,
302
+ 'image_id': str,
284
303
  'feature_name': str,
285
304
  'error': str,
286
305
  }
@@ -291,6 +310,7 @@ class MetricWriter(pg.Object, base.EventHandler):
291
310
  parameters={
292
311
  'app': str,
293
312
  'environment_id': str,
313
+ 'image_id': str,
294
314
  'feature_name': str,
295
315
  'error': str,
296
316
  }
@@ -301,6 +321,7 @@ class MetricWriter(pg.Object, base.EventHandler):
301
321
  parameters={
302
322
  'app': str,
303
323
  'environment_id': str,
324
+ 'image_id': str,
304
325
  'feature_name': str,
305
326
  'error': str,
306
327
  }
@@ -316,6 +337,7 @@ class MetricWriter(pg.Object, base.EventHandler):
316
337
  parameters={
317
338
  'app': str,
318
339
  'environment_id': str,
340
+ 'image_id': str,
319
341
  'error': str,
320
342
  }
321
343
  )
@@ -325,6 +347,7 @@ class MetricWriter(pg.Object, base.EventHandler):
325
347
  parameters={
326
348
  'app': str,
327
349
  'environment_id': str,
350
+ 'image_id': str,
328
351
  'error': str,
329
352
  }
330
353
  )
@@ -334,6 +357,7 @@ class MetricWriter(pg.Object, base.EventHandler):
334
357
  parameters={
335
358
  'app': str,
336
359
  'environment_id': str,
360
+ 'image_id': str,
337
361
  'error': str,
338
362
  }
339
363
  )
@@ -371,12 +395,14 @@ class MetricWriter(pg.Object, base.EventHandler):
371
395
  self._sandbox_start.increment(
372
396
  app=self.app,
373
397
  environment_id=str(environment.id),
398
+ image_id=sandbox.image_id,
374
399
  error=self._error_tag(error)
375
400
  )
376
401
  self._sandbox_start_duration_ms.record(
377
402
  int(duration * 1000),
378
403
  app=self.app,
379
404
  environment_id=str(environment.id),
405
+ image_id=sandbox.image_id,
380
406
  error=self._error_tag(error)
381
407
  )
382
408
 
@@ -392,6 +418,7 @@ class MetricWriter(pg.Object, base.EventHandler):
392
418
  int(span * 1000),
393
419
  app=self.app,
394
420
  environment_id=str(environment.id),
421
+ image_id=sandbox.image_id,
395
422
  status=old_status.value
396
423
  )
397
424
  if old_status != base.Sandbox.Status.CREATED:
@@ -399,12 +426,14 @@ class MetricWriter(pg.Object, base.EventHandler):
399
426
  delta=-1,
400
427
  app=self.app,
401
428
  environment_id=str(environment.id),
429
+ image_id=sandbox.image_id,
402
430
  status=old_status.value
403
431
  )
404
432
  if new_status != base.Sandbox.Status.OFFLINE:
405
433
  self._sandbox_count.increment(
406
434
  app=self.app,
407
435
  environment_id=str(environment.id),
436
+ image_id=sandbox.image_id,
408
437
  status=new_status.value
409
438
  )
410
439
 
@@ -419,18 +448,21 @@ class MetricWriter(pg.Object, base.EventHandler):
419
448
  self._sandbox_shutdown.increment(
420
449
  app=self.app,
421
450
  environment_id=str(environment.id),
451
+ image_id=sandbox.image_id,
422
452
  error=self._error_tag(error)
423
453
  )
424
454
  self._sandbox_shutdown_duration_ms.record(
425
455
  int(duration * 1000),
426
456
  app=self.app,
427
457
  environment_id=str(environment.id),
458
+ image_id=sandbox.image_id,
428
459
  error=self._error_tag(error)
429
460
  )
430
461
  self._sandbox_lifetime_ms.record(
431
462
  int(lifetime * 1000),
432
463
  app=self.app,
433
464
  environment_id=str(environment.id),
465
+ image_id=sandbox.image_id,
434
466
  error=self._error_tag(error)
435
467
  )
436
468
 
@@ -447,12 +479,14 @@ class MetricWriter(pg.Object, base.EventHandler):
447
479
  self._sandbox_housekeep.increment(
448
480
  app=self.app,
449
481
  environment_id=str(environment.id),
482
+ image_id=sandbox.image_id,
450
483
  error=self._error_tag(error)
451
484
  )
452
485
  self._sandbox_housekeep_duration_ms.record(
453
486
  int(duration * 1000),
454
487
  app=self.app,
455
488
  environment_id=str(environment.id),
489
+ image_id=sandbox.image_id,
456
490
  error=self._error_tag(error)
457
491
  )
458
492
 
@@ -468,6 +502,7 @@ class MetricWriter(pg.Object, base.EventHandler):
468
502
  self._feature_setup.increment(
469
503
  app=self.app,
470
504
  environment_id=str(environment.id),
505
+ image_id=sandbox.image_id,
471
506
  feature_name=feature.name,
472
507
  error=self._error_tag(error)
473
508
  )
@@ -475,6 +510,7 @@ class MetricWriter(pg.Object, base.EventHandler):
475
510
  int(duration * 1000),
476
511
  app=self.app,
477
512
  environment_id=str(environment.id),
513
+ image_id=sandbox.image_id,
478
514
  feature_name=feature.name,
479
515
  error=self._error_tag(error)
480
516
  )
@@ -491,6 +527,7 @@ class MetricWriter(pg.Object, base.EventHandler):
491
527
  self._feature_teardown.increment(
492
528
  app=self.app,
493
529
  environment_id=str(environment.id),
530
+ image_id=sandbox.image_id,
494
531
  feature_name=feature.name,
495
532
  error=self._error_tag(error)
496
533
  )
@@ -498,6 +535,7 @@ class MetricWriter(pg.Object, base.EventHandler):
498
535
  int(duration * 1000),
499
536
  app=self.app,
500
537
  environment_id=str(environment.id),
538
+ image_id=sandbox.image_id,
501
539
  feature_name=feature.name,
502
540
  error=self._error_tag(error)
503
541
  )
@@ -515,6 +553,7 @@ class MetricWriter(pg.Object, base.EventHandler):
515
553
  self._feature_setup_session.increment(
516
554
  app=self.app,
517
555
  environment_id=str(environment.id),
556
+ image_id=sandbox.image_id,
518
557
  feature_name=feature.name,
519
558
  error=self._error_tag(error)
520
559
  )
@@ -522,6 +561,7 @@ class MetricWriter(pg.Object, base.EventHandler):
522
561
  int(duration * 1000),
523
562
  app=self.app,
524
563
  environment_id=str(environment.id),
564
+ image_id=sandbox.image_id,
525
565
  feature_name=feature.name,
526
566
  error=self._error_tag(error)
527
567
  )
@@ -539,6 +579,7 @@ class MetricWriter(pg.Object, base.EventHandler):
539
579
  self._feature_teardown_session.increment(
540
580
  app=self.app,
541
581
  environment_id=str(environment.id),
582
+ image_id=sandbox.image_id,
542
583
  feature_name=feature.name,
543
584
  error=self._error_tag(error)
544
585
  )
@@ -546,6 +587,7 @@ class MetricWriter(pg.Object, base.EventHandler):
546
587
  int(duration * 1000),
547
588
  app=self.app,
548
589
  environment_id=str(environment.id),
590
+ image_id=sandbox.image_id,
549
591
  feature_name=feature.name,
550
592
  error=self._error_tag(error)
551
593
  )
@@ -564,6 +606,7 @@ class MetricWriter(pg.Object, base.EventHandler):
564
606
  self._feature_housekeep.increment(
565
607
  app=self.app,
566
608
  environment_id=str(environment.id),
609
+ image_id=sandbox.image_id,
567
610
  feature_name=feature.name,
568
611
  error=self._error_tag(error)
569
612
  )
@@ -571,6 +614,7 @@ class MetricWriter(pg.Object, base.EventHandler):
571
614
  int(duration * 1000),
572
615
  app=self.app,
573
616
  environment_id=str(environment.id),
617
+ image_id=sandbox.image_id,
574
618
  feature_name=feature.name,
575
619
  error=self._error_tag(error)
576
620
  )
@@ -588,6 +632,7 @@ class MetricWriter(pg.Object, base.EventHandler):
588
632
  int(duration * 1000),
589
633
  app=self.app,
590
634
  environment_id=str(environment.id),
635
+ image_id=sandbox.image_id,
591
636
  error=self._error_tag(error)
592
637
  )
593
638
 
@@ -605,12 +650,14 @@ class MetricWriter(pg.Object, base.EventHandler):
605
650
  int(duration * 1000),
606
651
  app=self.app,
607
652
  environment_id=str(environment.id),
653
+ image_id=sandbox.image_id,
608
654
  error=self._error_tag(error)
609
655
  )
610
656
  self._session_lifetime_ms.record(
611
657
  int(lifetime * 1000),
612
658
  app=self.app,
613
659
  environment_id=str(environment.id),
660
+ image_id=sandbox.image_id,
614
661
  error=self._error_tag(error)
615
662
  )
616
663
 
@@ -629,6 +676,7 @@ class MetricWriter(pg.Object, base.EventHandler):
629
676
  self._sandbox_activity.increment(
630
677
  app=self.app,
631
678
  environment_id=str(environment.id),
679
+ image_id=sandbox.image_id,
632
680
  activity=name,
633
681
  error=self._error_tag(error)
634
682
  )
@@ -636,6 +684,7 @@ class MetricWriter(pg.Object, base.EventHandler):
636
684
  int(duration * 1000),
637
685
  app=self.app,
638
686
  environment_id=str(environment.id),
687
+ image_id=sandbox.image_id,
639
688
  activity=name,
640
689
  error=self._error_tag(error)
641
690
  )
@@ -36,17 +36,18 @@ class MetricWriterTest(unittest.TestCase):
36
36
  event_handlers=[writer],
37
37
  )
38
38
  with env:
39
- with env.sandbox('session1') as sb:
39
+ with env.sandbox(session_id='session1') as sb:
40
40
  self.assertEqual(sb.test_feature1.num_shell_calls(), 4)
41
41
 
42
42
  with self.assertRaises(interface.SandboxStateError):
43
- with env.sandbox('session2') as sb:
43
+ with env.sandbox(session_id='session2') as sb:
44
44
  sb.shell('echo "bar"', raise_error=RuntimeError)
45
45
 
46
46
  self.assertIn(
47
47
  writer._sandbox_start.value(
48
48
  app='test_app',
49
49
  environment_id='testing-env',
50
+ image_id='test_image',
50
51
  error='Success'
51
52
  ),
52
53
  (2, 3)
@@ -55,6 +56,7 @@ class MetricWriterTest(unittest.TestCase):
55
56
  writer._sandbox_housekeep.value(
56
57
  app='test_app',
57
58
  environment_id='testing-env',
59
+ image_id='test_image',
58
60
  error='Success'
59
61
  ),
60
62
  0,
@@ -63,6 +65,7 @@ class MetricWriterTest(unittest.TestCase):
63
65
  writer._sandbox_shutdown.value(
64
66
  app='test_app',
65
67
  environment_id='testing-env',
68
+ image_id='test_image',
66
69
  error='Success'
67
70
  ),
68
71
  2
@@ -71,6 +74,7 @@ class MetricWriterTest(unittest.TestCase):
71
74
  writer._sandbox_count.value(
72
75
  app='test_app',
73
76
  environment_id='testing-env',
77
+ image_id='test_image',
74
78
  status='ready',
75
79
  ),
76
80
  0
@@ -79,6 +83,7 @@ class MetricWriterTest(unittest.TestCase):
79
83
  writer._sandbox_count.value(
80
84
  app='test_app',
81
85
  environment_id='testing-env',
86
+ image_id='test_image',
82
87
  status='offline',
83
88
  ),
84
89
  0
@@ -87,6 +92,7 @@ class MetricWriterTest(unittest.TestCase):
87
92
  writer._feature_setup.value(
88
93
  app='test_app',
89
94
  environment_id='testing-env',
95
+ image_id='test_image',
90
96
  feature_name='test_feature1',
91
97
  error='Success'
92
98
  ),
@@ -96,6 +102,7 @@ class MetricWriterTest(unittest.TestCase):
96
102
  writer._feature_setup.value(
97
103
  app='test_app',
98
104
  environment_id='testing-env',
105
+ image_id='test_image',
99
106
  feature_name='test_feature2',
100
107
  error='Success'
101
108
  ),
@@ -105,6 +112,7 @@ class MetricWriterTest(unittest.TestCase):
105
112
  writer._feature_setup_session.value(
106
113
  app='test_app',
107
114
  environment_id='testing-env',
115
+ image_id='test_image',
108
116
  feature_name='test_feature1',
109
117
  error='Success'
110
118
  ),
@@ -114,6 +122,7 @@ class MetricWriterTest(unittest.TestCase):
114
122
  writer._feature_setup_session.value(
115
123
  app='test_app',
116
124
  environment_id='testing-env',
125
+ image_id='test_image',
117
126
  feature_name='test_feature2',
118
127
  error='Success'
119
128
  ),
@@ -123,6 +132,7 @@ class MetricWriterTest(unittest.TestCase):
123
132
  writer._feature_teardown_session.value(
124
133
  app='test_app',
125
134
  environment_id='testing-env',
135
+ image_id='test_image',
126
136
  feature_name='test_feature1',
127
137
  error='Success'
128
138
  ),
@@ -132,6 +142,7 @@ class MetricWriterTest(unittest.TestCase):
132
142
  writer._feature_teardown_session.value(
133
143
  app='test_app',
134
144
  environment_id='testing-env',
145
+ image_id='test_image',
135
146
  feature_name='test_feature2',
136
147
  error='Success'
137
148
  ),
@@ -141,6 +152,7 @@ class MetricWriterTest(unittest.TestCase):
141
152
  writer._feature_teardown.value(
142
153
  app='test_app',
143
154
  environment_id='testing-env',
155
+ image_id='test_image',
144
156
  feature_name='test_feature1',
145
157
  error='Success'
146
158
  ),
@@ -150,6 +162,7 @@ class MetricWriterTest(unittest.TestCase):
150
162
  writer._feature_teardown.value(
151
163
  app='test_app',
152
164
  environment_id='testing-env',
165
+ image_id='test_image',
153
166
  feature_name='test_feature2',
154
167
  error='Success'
155
168
  ),
@@ -159,6 +172,7 @@ class MetricWriterTest(unittest.TestCase):
159
172
  writer._feature_housekeep.value(
160
173
  app='test_app',
161
174
  environment_id='testing-env',
175
+ image_id='test_image',
162
176
  feature_name='test_feature1',
163
177
  error='Success'
164
178
  ),
@@ -168,6 +182,7 @@ class MetricWriterTest(unittest.TestCase):
168
182
  writer._feature_housekeep.value(
169
183
  app='test_app',
170
184
  environment_id='testing-env',
185
+ image_id='test_image',
171
186
  feature_name='test_feature2',
172
187
  error='Success'
173
188
  ),
@@ -177,6 +192,7 @@ class MetricWriterTest(unittest.TestCase):
177
192
  writer._sandbox_activity.value(
178
193
  app='test_app',
179
194
  environment_id='testing-env',
195
+ image_id='test_image',
180
196
  activity='shell',
181
197
  error='Success'
182
198
  ),
@@ -186,6 +202,7 @@ class MetricWriterTest(unittest.TestCase):
186
202
  writer._sandbox_activity.value(
187
203
  app='test_app',
188
204
  environment_id='testing-env',
205
+ image_id='test_image',
189
206
  activity='shell',
190
207
  error='RuntimeError'
191
208
  ),