cometx 3.2.2__tar.gz → 3.3.0__tar.gz

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.
Files changed (56) hide show
  1. {cometx-3.2.2/cometx.egg-info → cometx-3.3.0}/PKG-INFO +1 -1
  2. {cometx-3.2.2 → cometx-3.3.0}/cometx/_version.py +1 -1
  3. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/__init__.py +4 -0
  4. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/admin.py +298 -45
  5. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/admin_gpu_report.py +207 -15
  6. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/admin_optimizer_report.py +216 -49
  7. cometx-3.3.0/cometx/cli/upload.py +150 -0
  8. cometx-3.3.0/cometx/cli/upload_optimizer_experiments.py +469 -0
  9. {cometx-3.2.2 → cometx-3.3.0/cometx.egg-info}/PKG-INFO +1 -1
  10. {cometx-3.2.2 → cometx-3.3.0}/cometx.egg-info/SOURCES.txt +2 -0
  11. {cometx-3.2.2 → cometx-3.3.0}/LICENSE +0 -0
  12. {cometx-3.2.2 → cometx-3.3.0}/MANIFEST.in +0 -0
  13. {cometx-3.2.2 → cometx-3.3.0}/README.md +0 -0
  14. {cometx-3.2.2 → cometx-3.3.0}/cometx/__init__.py +0 -0
  15. {cometx-3.2.2 → cometx-3.3.0}/cometx/_typing.py +0 -0
  16. {cometx-3.2.2 → cometx-3.3.0}/cometx/_ui.py +0 -0
  17. {cometx-3.2.2 → cometx-3.3.0}/cometx/api.py +0 -0
  18. {cometx-3.2.2 → cometx-3.3.0}/cometx/audio.py +0 -0
  19. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/admin_app.py +0 -0
  20. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/admin_usage_report.py +0 -0
  21. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/admin_utils.py +0 -0
  22. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/config.py +0 -0
  23. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/copy.py +0 -0
  24. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/copy_utils.py +0 -0
  25. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/count.py +0 -0
  26. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/delete_assets.py +0 -0
  27. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/download.py +0 -0
  28. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/list_command.py +0 -0
  29. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/log.py +0 -0
  30. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/reproduce.py +0 -0
  31. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/smoke_test.py +0 -0
  32. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/update.py +0 -0
  33. {cometx-3.2.2 → cometx-3.3.0}/cometx/cli/utils.py +0 -0
  34. {cometx-3.2.2 → cometx-3.3.0}/cometx/framework/__init__.py +0 -0
  35. {cometx-3.2.2 → cometx-3.3.0}/cometx/framework/comet/__init__.py +0 -0
  36. {cometx-3.2.2 → cometx-3.3.0}/cometx/framework/comet/download_manager.py +0 -0
  37. {cometx-3.2.2 → cometx-3.3.0}/cometx/framework/wandb.py +0 -0
  38. {cometx-3.2.2 → cometx-3.3.0}/cometx/generate_utils.py +0 -0
  39. {cometx-3.2.2 → cometx-3.3.0}/cometx/magics.py +0 -0
  40. {cometx-3.2.2 → cometx-3.3.0}/cometx/optimizer.py +0 -0
  41. {cometx-3.2.2 → cometx-3.3.0}/cometx/panel_utils.py +0 -0
  42. {cometx-3.2.2 → cometx-3.3.0}/cometx/tools/__init__.py +0 -0
  43. {cometx-3.2.2 → cometx-3.3.0}/cometx/tools/dataset.py +0 -0
  44. {cometx-3.2.2 → cometx-3.3.0}/cometx/tools/pointcloud.py +0 -0
  45. {cometx-3.2.2 → cometx-3.3.0}/cometx/utils.py +0 -0
  46. {cometx-3.2.2 → cometx-3.3.0}/cometx.egg-info/dependency_links.txt +0 -0
  47. {cometx-3.2.2 → cometx-3.3.0}/cometx.egg-info/entry_points.txt +0 -0
  48. {cometx-3.2.2 → cometx-3.3.0}/cometx.egg-info/requires.txt +0 -0
  49. {cometx-3.2.2 → cometx-3.3.0}/cometx.egg-info/top_level.txt +0 -0
  50. {cometx-3.2.2 → cometx-3.3.0}/pyproject.toml +0 -0
  51. {cometx-3.2.2 → cometx-3.3.0}/setup.cfg +0 -0
  52. {cometx-3.2.2 → cometx-3.3.0}/setup.py +0 -0
  53. {cometx-3.2.2 → cometx-3.3.0}/tests/__init__.py +0 -0
  54. {cometx-3.2.2 → cometx-3.3.0}/tests/integration/__init__.py +0 -0
  55. {cometx-3.2.2 → cometx-3.3.0}/tests/integration/test_download.py +0 -0
  56. {cometx-3.2.2 → cometx-3.3.0}/tests/testlib.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cometx
3
- Version: 3.2.2
3
+ Version: 3.3.0
4
4
  Summary: Python tools for Comet
5
5
  Home-page: https://github.com/comet-ml/cometx/
6
6
  Author: cometx development team
@@ -12,5 +12,5 @@
12
12
  # the express permission of Comet ML Inc.
13
13
  # *******************************************************
14
14
 
15
- version_info = (3, 2, 2)
15
+ version_info = (3, 3, 0)
16
16
  __version__ = ".".join(map(str, version_info))
@@ -48,6 +48,7 @@ from . import (
48
48
  reproduce,
49
49
  smoke_test,
50
50
  update,
51
+ upload_optimizer_experiments,
51
52
  )
52
53
 
53
54
 
@@ -103,6 +104,9 @@ def main(raw_args=sys.argv[1:]):
103
104
  add_subparser(subparsers, reproduce, "reproduce")
104
105
  add_subparser(subparsers, config, "config")
105
106
  add_subparser(subparsers, smoke_test, "smoke-test")
107
+ add_subparser(
108
+ subparsers, upload_optimizer_experiments, "upload-optimizer-experiments"
109
+ )
106
110
 
107
111
  # Parse arguments
108
112
  args, rest = parser.parse_known_args(raw_args)
@@ -90,6 +90,33 @@ Commands:
90
90
  Output:
91
91
  Returns a dictionary of metrics keyed by experiment key.
92
92
 
93
+ optimizer-report
94
+ Generate a report for an optimizer instance.
95
+
96
+ Usage:
97
+ cometx admin optimizer-report OPTIMIZER_ID
98
+ cometx admin optimizer-report OPTIMIZER_ID --app
99
+
100
+ Arguments:
101
+ OPTIMIZER_ID (required)
102
+ The optimizer instance ID to generate a report for.
103
+
104
+ Options:
105
+ --app
106
+ Launch interactive Streamlit web app instead of generating JSON file.
107
+
108
+ Output:
109
+ Without --app:
110
+ Generates a JSON file containing all dashboard/data items:
111
+ - optimizer-report-{OPTIMIZER_ID}.json
112
+
113
+ With --app:
114
+ Launches an interactive web interface where you can:
115
+ - View optimizer dashboard with statistics
116
+ - Filter by status
117
+ - Navigate through paginated job assignments
118
+ - View summary statistics
119
+
93
120
  Global Options (available for all commands):
94
121
  --api-key KEY
95
122
  Set the COMET_API_KEY for authentication.
@@ -113,17 +140,21 @@ Examples:
113
140
  cometx admin gpu-report my-workspace --start-date 2024-01-01
114
141
  cometx admin gpu-report my-workspace --start-date 2024-01-01 --end-date 2024-12-31
115
142
  cometx admin gpu-report workspace1/project1 workspace2 --start-date 2024-01-01 --metrics sys.gpu.0.gpu_utilization
143
+ cometx admin optimizer-report abc123def456
144
+ cometx admin optimizer-report abc123def456 --app
116
145
 
117
146
  """
118
147
 
119
148
  import argparse
120
149
  import json
150
+ import os
121
151
  import sys
122
152
  from urllib.parse import urlparse
123
153
 
124
154
  from comet_ml import API
125
155
 
126
156
  from .admin_gpu_report import main as gpu_report_main
157
+ from .admin_optimizer_report import generate_json_report
127
158
  from .admin_usage_report import generate_usage_report
128
159
 
129
160
  ADDITIONAL_ARGS = False
@@ -275,7 +306,7 @@ Arguments:
275
306
 
276
307
  Options:
277
308
  --start-date DATE
278
- Start date for the report in YYYY-MM-DD format (required).
309
+ Start date for the report in YYYY-MM-DD format (optional, collects all data if not provided).
279
310
 
280
311
  --end-date DATE
281
312
  End date for the report in YYYY-MM-DD format (optional).
@@ -293,18 +324,35 @@ Options:
293
324
  --open
294
325
  Automatically open the generated PDF file after generation.
295
326
 
327
+ --app
328
+ Launch interactive Streamlit web app instead of generating PDF.
329
+ The JSON file will be generated first and automatically loaded in the app.
330
+ The app allows you to interactively change aggregation (workspace, project, user),
331
+ time units (year, month, week, day), and date ranges.
332
+
296
333
  Output:
297
- Generates a PDF report containing:
298
- - Summary statistics (total experiments, workspaces, metrics tracked)
299
- - Average metrics by workspace charts
300
- - Maximum metrics by month charts
334
+ Without --app:
335
+ Generates a PDF report and JSON file containing:
336
+ - Summary statistics (total experiments, workspaces, metrics tracked)
337
+ - Average metrics by workspace charts
338
+ - Maximum metrics by month charts
339
+ - JSON file: gpu_report_{workspace_projects}.json
340
+
341
+ With --app:
342
+ Launches an interactive web interface where you can:
343
+ - Change aggregation (workspace, project, user)
344
+ - Change time units (year, month, week, day)
345
+ - Select start and end dates from the data
346
+ - View charts for each metric
301
347
 
302
348
  Examples:
349
+ cometx admin gpu-report my-workspace
303
350
  cometx admin gpu-report my-workspace --start-date 2024-01-01
304
351
  cometx admin gpu-report my-workspace --start-date 2024-01-01 --end-date 2024-12-31
305
- cometx admin gpu-report workspace1/project1 workspace2 --start-date 2024-01-01
306
- cometx admin gpu-report my-workspace --start-date 2024-01-01 --metrics sys.gpu.0.gpu_utilization sys.gpu.0.memory_utilization
307
- cometx admin gpu-report my-workspace --start-date 2024-01-01 --open
352
+ cometx admin gpu-report workspace1/project1 workspace2
353
+ cometx admin gpu-report my-workspace --metrics sys.gpu.0.gpu_utilization sys.gpu.0.memory_utilization
354
+ cometx admin gpu-report my-workspace --open
355
+ cometx admin gpu-report my-workspace --app
308
356
  """
309
357
  gpu_parser = subparsers.add_parser(
310
358
  "gpu-report",
@@ -316,16 +364,16 @@ Examples:
316
364
  add_global_arguments(gpu_parser)
317
365
  gpu_parser.add_argument(
318
366
  "WORKSPACE_PROJECT",
319
- nargs="+",
367
+ nargs="*",
320
368
  help="One or more WORKSPACE or WORKSPACE/PROJECT to run GPU report for",
321
369
  metavar="WORKSPACE",
322
370
  type=str,
323
371
  )
324
372
  gpu_parser.add_argument(
325
373
  "--start-date",
326
- help="Start date for the report in YYYY-MM-DD format (required)",
374
+ help="Start date for the report in YYYY-MM-DD format (optional, collects all data if not provided)",
327
375
  type=str,
328
- required=True,
376
+ required=False,
329
377
  )
330
378
  gpu_parser.add_argument(
331
379
  "--end-date",
@@ -346,6 +394,60 @@ Examples:
346
394
  default=False,
347
395
  action="store_true",
348
396
  )
397
+ gpu_parser.add_argument(
398
+ "--app",
399
+ help="Launch interactive Streamlit web app instead of generating PDF",
400
+ default=False,
401
+ action="store_true",
402
+ )
403
+
404
+ # optimizer-report subcommand
405
+ optimizer_report_description = """Generate a report for an optimizer instance.
406
+
407
+ Arguments:
408
+ OPTIMIZER_ID (required)
409
+ The optimizer instance ID to generate a report for.
410
+
411
+ Options:
412
+ --app
413
+ Launch interactive Streamlit web app instead of generating JSON file.
414
+
415
+ Output:
416
+ Without --app:
417
+ Generates a JSON file containing all dashboard/data items:
418
+ - optimizer-report-{OPTIMIZER_ID}.json
419
+
420
+ With --app:
421
+ Launches an interactive web interface where you can:
422
+ - View optimizer dashboard with statistics
423
+ - Filter by status
424
+ - Navigate through paginated job assignments
425
+ - View summary statistics
426
+
427
+ Examples:
428
+ cometx admin optimizer-report abc123def456
429
+ cometx admin optimizer-report abc123def456 --app
430
+ """
431
+ optimizer_parser = subparsers.add_parser(
432
+ "optimizer-report",
433
+ help="Generate a report for an optimizer instance",
434
+ description=optimizer_report_description,
435
+ formatter_class=argparse.RawDescriptionHelpFormatter,
436
+ )
437
+ # Add global arguments to subparser so they show in help
438
+ add_global_arguments(optimizer_parser)
439
+ optimizer_parser.add_argument(
440
+ "OPTIMIZER_ID",
441
+ help="The optimizer instance ID to generate a report for",
442
+ metavar="OPTIMIZER_ID",
443
+ type=str,
444
+ )
445
+ optimizer_parser.add_argument(
446
+ "--app",
447
+ help="Launch interactive Streamlit web app instead of generating JSON file",
448
+ default=False,
449
+ action="store_true",
450
+ )
349
451
 
350
452
 
351
453
  def admin(parsed_args, remaining=None):
@@ -391,8 +493,6 @@ def admin(parsed_args, remaining=None):
391
493
  elif parsed_args.ACTION == "usage-report":
392
494
  if parsed_args.app:
393
495
  # Launch Streamlit app
394
- import os
395
- import sys
396
496
 
397
497
  # Set environment variables if --api-key or --url-override were provided
398
498
  if parsed_args.api_key:
@@ -440,44 +540,197 @@ def admin(parsed_args, remaining=None):
440
540
  print("ERROR: " + str(e))
441
541
  return
442
542
  elif parsed_args.ACTION == "gpu-report":
443
- workspace_projects = parsed_args.WORKSPACE_PROJECT
543
+ workspace_projects = parsed_args.WORKSPACE_PROJECT or []
444
544
  start_date = parsed_args.start_date
445
545
  end_date = parsed_args.end_date
446
546
  metrics = parsed_args.metrics
447
547
 
448
- try:
449
- result = gpu_report_main(
450
- workspace_projects=workspace_projects,
451
- start_date=start_date,
452
- end_date=end_date,
453
- metrics=metrics,
454
- max_workers=None, # Use default
455
- )
456
- if result:
457
- num_experiments = len(result.get("metrics", {}))
458
- num_charts = len(result.get("charts", []))
459
- pdf_file = result.get("pdf_file")
548
+ if parsed_args.app:
549
+ # Require workspace_projects for --app
550
+ if not workspace_projects:
551
+ print(
552
+ "ERROR: At least one workspace/project is required when using --app"
553
+ )
554
+ return
555
+
556
+ # Generate JSON first
557
+ json_file_path = None
558
+ try:
559
+ print("Generating GPU report data...")
560
+ result = gpu_report_main(
561
+ workspace_projects=workspace_projects,
562
+ start_date=start_date,
563
+ end_date=end_date,
564
+ metrics=metrics,
565
+ max_workers=None, # Use default
566
+ )
567
+ if result:
568
+ json_file_path = result.get("json_file")
569
+ if json_file_path:
570
+ print(f"JSON report saved: {json_file_path}")
571
+ else:
572
+ print("ERROR: JSON file was not created")
573
+ return
574
+ else:
575
+ print("ERROR: Failed to generate GPU report data")
576
+ return
577
+ except Exception as e:
578
+ print(f"ERROR: Could not generate JSON file: {e}")
579
+ if parsed_args.debug:
580
+ import traceback
581
+
582
+ traceback.print_exc()
583
+ return
584
+
585
+ # Launch Streamlit app
586
+ # Set environment variables if --api-key or --url-override were provided
587
+ if parsed_args.api_key:
588
+ os.environ["COMET_API_KEY"] = parsed_args.api_key
589
+ if parsed_args.url_override:
590
+ os.environ["COMET_URL_OVERRIDE"] = parsed_args.url_override
591
+
592
+ # Run the Streamlit app using streamlit's CLI
593
+ try:
594
+ import tempfile
595
+
596
+ import streamlit.web.cli as stcli
597
+
598
+ # Get the path to admin_gpu_app.py
599
+ gpu_app_path = os.path.join(
600
+ os.path.dirname(os.path.abspath(__file__)), "admin_gpu_app.py"
601
+ )
602
+
603
+ # Write JSON file path to a temp file
604
+ # The Streamlit app will read this file
605
+ temp_dir = tempfile.gettempdir()
606
+ json_path_file = os.path.join(
607
+ temp_dir, "comet_gpu_report_json_path.txt"
608
+ )
609
+ with open(json_path_file, "w") as f:
610
+ f.write(os.path.abspath(json_file_path))
611
+
612
+ # Launch streamlit with the app
613
+ sys.argv = ["streamlit", "run", gpu_app_path]
614
+ stcli.main()
615
+ except Exception as e:
616
+ print(f"ERROR launching Streamlit app: {e}")
617
+ if parsed_args.debug:
618
+ raise
619
+ return
620
+ else:
621
+ # Generate report (JSON is always saved by gpu_report_main)
622
+ if not workspace_projects:
460
623
  print(
461
- f"\nGPU report completed. Processed {num_experiments} experiments."
624
+ "ERROR: At least one workspace/project is required when not using --app"
462
625
  )
463
- if num_charts > 0:
464
- print(f"Generated {num_charts} charts:")
465
- for chart_file in result.get("charts", []):
466
- print(f" - {chart_file}")
467
- if pdf_file:
468
- print(f"PDF report: {pdf_file}")
469
- # Open PDF if --open flag is set
470
- if parsed_args.open:
471
- from .admin_gpu_report import open_pdf
472
-
473
- open_pdf(pdf_file, debug=parsed_args.debug)
474
- except Exception as e:
475
- print("ERROR: " + str(e))
476
- if parsed_args.debug:
477
- import traceback
478
-
479
- traceback.print_exc()
480
- return
626
+ return
627
+ try:
628
+ result = gpu_report_main(
629
+ workspace_projects=workspace_projects,
630
+ start_date=start_date,
631
+ end_date=end_date,
632
+ metrics=metrics,
633
+ max_workers=None, # Use default
634
+ )
635
+ if result:
636
+ num_experiments = len(result.get("metrics", {}))
637
+ num_charts = len(result.get("charts", []))
638
+ pdf_file = result.get("pdf_file")
639
+ json_file = result.get("json_file")
640
+
641
+ print(
642
+ f"\nGPU report completed. Processed {num_experiments} experiments."
643
+ )
644
+ if num_charts > 0:
645
+ print(f"Generated {num_charts} charts:")
646
+ for chart_file in result.get("charts", []):
647
+ print(f" - {chart_file}")
648
+ if json_file:
649
+ print(f"JSON report: {json_file}")
650
+ if pdf_file:
651
+ print(f"PDF report: {pdf_file}")
652
+ # Open PDF if --open flag is set
653
+ if parsed_args.open:
654
+ from .admin_gpu_report import open_pdf
655
+
656
+ open_pdf(pdf_file, debug=parsed_args.debug)
657
+ except Exception as e:
658
+ print("ERROR: " + str(e))
659
+ if parsed_args.debug:
660
+ import traceback
661
+
662
+ traceback.print_exc()
663
+ return
664
+ elif parsed_args.ACTION == "optimizer-report":
665
+ optimizer_id = parsed_args.OPTIMIZER_ID
666
+
667
+ if parsed_args.app:
668
+ # Launch Streamlit app
669
+ # Set environment variables if --api-key or --url-override were provided
670
+ if parsed_args.api_key:
671
+ os.environ["COMET_API_KEY"] = parsed_args.api_key
672
+ if parsed_args.url_override:
673
+ os.environ["COMET_URL_OVERRIDE"] = parsed_args.url_override
674
+
675
+ # Run the Streamlit app using streamlit's CLI
676
+ try:
677
+ import streamlit.web.cli as stcli
678
+
679
+ # Get the path to admin_optimizer_report.py
680
+ optimizer_app_path = os.path.join(
681
+ os.path.dirname(os.path.abspath(__file__)),
682
+ "admin_optimizer_report.py",
683
+ )
684
+
685
+ # Set optimizer ID in environment so the app can access it
686
+ # Use COMET_OPTIMIZER_ID if not already set
687
+ if "COMET_OPTIMIZER_ID" not in os.environ:
688
+ os.environ["COMET_OPTIMIZER_ID"] = optimizer_id
689
+
690
+ # Launch streamlit with the app (Streamlit will automatically open the browser)
691
+ sys.argv = ["streamlit", "run", optimizer_app_path]
692
+ stcli.main()
693
+ except Exception as e:
694
+ print(f"ERROR launching Streamlit app: {e}")
695
+ if parsed_args.debug:
696
+ raise
697
+ return
698
+ else:
699
+ # Generate JSON report
700
+ try:
701
+ # Get API key and optimizer URL from config or arguments
702
+ from comet_ml.config import get_config, get_optimizer_address
703
+
704
+ config_obj = get_config()
705
+
706
+ # Get API key from parsed args, config, or environment
707
+ api_key = parsed_args.api_key
708
+ if not api_key:
709
+ try:
710
+ api_key = config_obj["comet.api_key"]
711
+ except (KeyError, TypeError):
712
+ api_key = os.environ.get("COMET_API_KEY")
713
+
714
+ # Get optimizer URL from config
715
+ optimizer_url = get_optimizer_address(config_obj)
716
+
717
+ result = generate_json_report(
718
+ optimizer_id=optimizer_id,
719
+ api_key=api_key,
720
+ optimizer_url=optimizer_url,
721
+ )
722
+ if result:
723
+ print(f"\nOptimizer report generated successfully: {result}")
724
+ else:
725
+ print("ERROR: Failed to generate optimizer report")
726
+ return
727
+ except Exception as e:
728
+ print("ERROR: " + str(e))
729
+ if parsed_args.debug:
730
+ import traceback
731
+
732
+ traceback.print_exc()
733
+ return
481
734
 
482
735
  except KeyboardInterrupt:
483
736
  if parsed_args.debug: