code-loader 1.0.139.dev1__py3-none-any.whl → 1.0.139.dev3__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 code-loader might be problematic. Click here for more details.

@@ -26,6 +26,7 @@ import functools
26
26
 
27
27
  _called_from_inside_tl_decorator = 0
28
28
  _called_from_inside_tl_integration_test_decorator = False
29
+ _update_env_status = None
29
30
 
30
31
 
31
32
 
@@ -173,7 +174,10 @@ def tensorleap_integration_test():
173
174
  global _called_from_inside_tl_integration_test_decorator
174
175
  try:
175
176
  _called_from_inside_tl_integration_test_decorator = True
177
+ if not _update_env_status is None:
178
+ _update_env_status("tensorleap_integration_test", "v")#put here because otherwise it will become v only if it finishes all the script
176
179
  ret = integration_test_function(*args, **kwargs)
180
+
177
181
  try:
178
182
  os.environ[mapping_runtime_mode_env_var_mame] = 'True'
179
183
  integration_test_function(None, PreprocessResponse(state=DataStateType.training, length=0))
@@ -316,8 +320,10 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
316
320
 
317
321
  def get_inputs(self):
318
322
  return self.model.get_inputs()
319
-
320
- return ModelPlaceholder()
323
+ model_placeholder=ModelPlaceholder()
324
+ if not _update_env_status is None:
325
+ _update_env_status("tensorleap_load_model", "v")
326
+ return model_placeholder
321
327
 
322
328
  def mapping_inner():
323
329
  class ModelOutputPlaceholder:
@@ -385,7 +391,6 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
385
391
  return mapping_inner()
386
392
  else:
387
393
  return inner(*args, **kwargs)
388
-
389
394
  return final_inner
390
395
 
391
396
  return decorating_function
@@ -597,6 +602,8 @@ def tensorleap_custom_metric(name: str,
597
602
  result = inner_without_validate(*args, **kwargs)
598
603
 
599
604
  _validate_result(result)
605
+ if not _update_env_status is None:
606
+ _update_env_status("tensorleap_custom_metric","v")
600
607
  return result
601
608
 
602
609
  def mapping_inner(*args, **kwargs):
@@ -717,6 +724,8 @@ def tensorleap_custom_visualizer(name: str, visualizer_type: LeapDataType,
717
724
  result = inner_without_validate(*args, **kwargs)
718
725
 
719
726
  _validate_result(result)
727
+ if not _update_env_status is None:
728
+ _update_env_status("tensorleap_custom_visualizer","v")
720
729
  return result
721
730
 
722
731
  def mapping_inner(*args, **kwargs):
@@ -805,6 +814,8 @@ def tensorleap_metadata(
805
814
  result = inner_without_validate(sample_id, preprocess_response)
806
815
 
807
816
  _validate_result(result)
817
+ if not _update_env_status is None:
818
+ _update_env_status("tensorleap_metadata","v")
808
819
  return result
809
820
 
810
821
  return inner
@@ -893,6 +904,8 @@ def tensorleap_preprocess():
893
904
  _validate_input_args(*args, **kwargs)
894
905
  result = user_function()
895
906
  _validate_result(result)
907
+ if not _update_env_status is None:
908
+ _update_env_status("tensorleap_preprocess", "v")
896
909
  return result
897
910
 
898
911
  return inner
@@ -1134,6 +1147,8 @@ def tensorleap_input_encoder(name: str, channel_dim=-1, model_input_index=None):
1134
1147
  if _called_from_inside_tl_decorator == 0 and _called_from_inside_tl_integration_test_decorator:
1135
1148
  batch_warning(result,user_function.__name__)
1136
1149
  result = np.expand_dims(result, axis=0)
1150
+ if not _update_env_status is None:
1151
+ _update_env_status("tensorleap_input_encoder", "v")
1137
1152
 
1138
1153
  return result
1139
1154
 
@@ -1217,7 +1232,8 @@ def tensorleap_gt_encoder(name: str):
1217
1232
  if _called_from_inside_tl_decorator == 0 and _called_from_inside_tl_integration_test_decorator:
1218
1233
  batch_warning(result, user_function.__name__)
1219
1234
  result = np.expand_dims(result, axis=0)
1220
-
1235
+ if not _update_env_status is None:
1236
+ _update_env_status("tensorleap_gt_encoder", "v")
1221
1237
  return result
1222
1238
 
1223
1239
  inner.node_mapping = NodeMapping(name, NodeMappingType.GroundTruth)
@@ -1319,6 +1335,9 @@ def tensorleap_custom_loss(name: str, connects_to=None):
1319
1335
  result = inner_without_validate(*args, **kwargs)
1320
1336
 
1321
1337
  _validate_result(result)
1338
+ if not _update_env_status is None:
1339
+ _update_env_status("tensorleap_custom_loss", "v")
1340
+
1322
1341
  return result
1323
1342
 
1324
1343
  def mapping_inner(*args, **kwargs):
@@ -1375,3 +1394,87 @@ def tensorleap_custom_layer(name: str):
1375
1394
  return custom_layer
1376
1395
 
1377
1396
  return decorating_function
1397
+
1398
+
1399
+ def tensorleap_status_table():
1400
+ '''
1401
+ Usage example:
1402
+ ###################
1403
+ leap_integration.py
1404
+ ###################
1405
+ from code_loader.inner_leap_binder.leapbinder_decorators import tensorleap_status_table
1406
+ ...
1407
+ ...
1408
+ ...
1409
+ if __name__ == '__main__':
1410
+ tensorleap_status_table()
1411
+ ...
1412
+ '''
1413
+ import atexit
1414
+ import sys
1415
+ import traceback
1416
+
1417
+
1418
+ table = [
1419
+ {"name": "tensorleap_preprocess", "status": "x"},
1420
+ {"name": "tensorleap_integration_test", "status": "x"},
1421
+ {"name": "tensorleap_input_encoder", "status": "x"},
1422
+ {"name": "tensorleap_gt_encoder", "status": "x"},
1423
+ {"name": "tensorleap_load_model", "status": "x"},
1424
+ {"name": "tensorleap_custom_loss", "status": "x"},
1425
+ {"name": "tensorleap_custom_metric (optional)", "status": "x"},
1426
+ {"name": "tensorleap_metadata (optional)", "status": "x"},
1427
+ {"name": "tensorleap_custom_visualizer (optional)", "status": "x"},
1428
+
1429
+ ]
1430
+
1431
+ _finalizer_called = {"done": False}
1432
+
1433
+ def _print_table():
1434
+ ready_mess = "\nAll parts have been successfully set. If no errors accured, you can now push the project to the Tensorleap system."
1435
+ not_ready_mess = "\nSome mandatory components have not been set yet. Recommended next implementation step: "
1436
+ mandatory_ready_mess = "\nAll mandatory parts have been successfully set. If no errors accured, you can now push the project to the Tensorleap system or continue to the next optional implementation step: "
1437
+
1438
+ name_width = max(len(row["name"]) for row in table)
1439
+ status_width = max(len(row["status"]) for row in table)
1440
+ header = f"{'Function Name'.ljust(name_width)} | {'Status'.ljust(status_width)}"
1441
+ sep = "-" * len(header)
1442
+ print("\n" + header)
1443
+ print(sep)
1444
+ ready=True
1445
+ for row in table:
1446
+ print(f"{row['name'].ljust(name_width)} | {row['status'].ljust(status_width)}")
1447
+ if row['status']=='x' and ready:
1448
+ ready=False
1449
+ next_step=row['name']
1450
+
1451
+
1452
+ print(ready_mess) if ready else print(mandatory_ready_mess+next_step) if "optional" in next_step else print(not_ready_mess+next_step)
1453
+ def update_env_params(name: str, status: str = "✓"):
1454
+ for row in table:
1455
+ if row["name"].removesuffix(" (optional)") == name:
1456
+ row["status"] = status
1457
+ break
1458
+ def run_on_exit():
1459
+ if _finalizer_called["done"]:
1460
+ return
1461
+ _finalizer_called["done"] = True
1462
+ _print_table()
1463
+ def handle_exception(exc_type, exc_value, exc_traceback):
1464
+ traceback.print_exception(exc_type, exc_value, exc_traceback)
1465
+ run_on_exit()
1466
+ atexit.register(run_on_exit)
1467
+ sys.excepthook = handle_exception
1468
+ global _update_env_status
1469
+ _update_env_status = update_env_params
1470
+ return update_env_params
1471
+
1472
+
1473
+
1474
+
1475
+
1476
+
1477
+
1478
+
1479
+
1480
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.139.dev1
3
+ Version: 1.0.139.dev3
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -21,7 +21,7 @@ code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZ
21
21
  code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
22
22
  code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
23
23
  code_loader/inner_leap_binder/leapbinder.py,sha256=Q3D9yVM-GNEJfYRFvMV__BoZbcWOgnWKhrZXAv6Tu7o,33232
24
- code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=LJm_cERYB-8Rnbrb1VhcFP9qTw05351PisTJ7fV-T1Q,65974
24
+ code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=Rgt_9Kllc0yZVXPsk1yC1p2Yb2OMx3QXMQlQvuixpZ0,70055
25
25
  code_loader/leaploader.py,sha256=6D6xZzMI6qSNIb3tuKLB3BbK5H8QS1_r7iQjIXO3OkM,29795
26
26
  code_loader/leaploaderbase.py,sha256=LIFcC6xo6V_iiGN3BjibXETu_l84EWM_WIOKAvkfTiM,4458
27
27
  code_loader/mixpanel_tracker.py,sha256=l9z_szKKQ7apEbdNZpGH1TKAiT_TsBHb9AQnePaWTyo,4942
@@ -31,7 +31,7 @@ code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6Lz
31
31
  code_loader/utils.py,sha256=gXENTYpjdidq2dx0gVbXlErPeHoNs-4TYAZbLRe0y2c,2712
32
32
  code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  code_loader/visualizers/default_visualizers.py,sha256=onRnLE_TXfgLN4o52hQIOOhUcFexGlqJ3xSpQDVLuZM,2604
34
- code_loader-1.0.139.dev1.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
- code_loader-1.0.139.dev1.dist-info/METADATA,sha256=6MtalhJWO8K-VGlSboFnZeFKRat4yym4X5692p7Fssk,1095
36
- code_loader-1.0.139.dev1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
37
- code_loader-1.0.139.dev1.dist-info/RECORD,,
34
+ code_loader-1.0.139.dev3.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
+ code_loader-1.0.139.dev3.dist-info/METADATA,sha256=MQ-BRAy9_HLMKQnO0Dv0dHoZ8NGwbfd90eZULo_hcx4,1095
36
+ code_loader-1.0.139.dev3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
37
+ code_loader-1.0.139.dev3.dist-info/RECORD,,