| 359 | |
| 360 | |
| 361 | def log_long_command_as_params(cmd_string, max_param_length=450): # Conservative limit |
| 362 | if len(cmd_string) <= max_param_length: |
| 363 | mlflow.log_param('cmd', cmd_string) |
| 364 | else: |
| 365 | # Split into chunks |
| 366 | chunks = [] |
| 367 | start = 0 |
| 368 | while start < len(cmd_string): |
| 369 | end = start + max_param_length |
| 370 | chunks.append(cmd_string[start:end]) |
| 371 | start = end |
| 372 | |
| 373 | mlflow.log_param('cmd_total_parts', len(chunks)) |
| 374 | mlflow.log_param('cmd_full_length', len(cmd_string)) |
| 375 | |
| 376 | for i, chunk in enumerate(chunks): |
| 377 | mlflow.log_param(f'cmd_part_{i:02d}', chunk) |
| 378 | |
| 379 | |
| 380 | |