@@ -825,6 +825,8 @@ def build_launch_payload(
825825 param_values : dict | None = None ,
826826 resource_overrides : dict | None = None ,
827827 description : str | None = None ,
828+ enable_profiling : bool = False ,
829+ enable_profiling_torch : bool = False ,
828830) -> dict :
829831 """Build the payload for launching a task on a provider."""
830832 cfg = task .get ("config" ) or {}
@@ -852,6 +854,8 @@ def pick(field: str):
852854 "accelerators" : pick ("accelerators" ),
853855 "num_nodes" : pick ("num_nodes" ),
854856 "minutes_requested" : pick ("minutes_requested" ),
857+ "enable_profiling" : enable_profiling ,
858+ "enable_profiling_torch" : enable_profiling_torch ,
855859 "env_vars" : task .get ("env_vars" , {}),
856860 "parameters" : task .get ("parameters" , {}),
857861 "config" : param_values if param_values else None ,
@@ -1016,6 +1020,8 @@ def queue_task(
10161020 interactive : bool = True ,
10171021 description : str | None = None ,
10181022 param_overrides : dict | None = None ,
1023+ enable_profiling : bool = False ,
1024+ enable_profiling_torch : bool = False ,
10191025) -> None :
10201026 """Queue a task on a compute provider."""
10211027 with console .status ("[bold success]Fetching task...[/bold success]" , spinner = "dots" ):
@@ -1067,8 +1073,17 @@ def queue_task(
10671073 param_values = {k : (v .get ("default" , "" ) if isinstance (v , dict ) else v ) for k , v in parameters .items ()}
10681074 param_values .update (overrides )
10691075
1076+ if enable_profiling_torch and not enable_profiling :
1077+ raise typer .BadParameter ("--enable-profiling-torch requires --enable-profiling." )
1078+
10701079 payload = build_launch_payload (
1071- task , provider .get ("name" ), param_values , resource_overrides , description = description
1080+ task ,
1081+ provider .get ("name" ),
1082+ param_values ,
1083+ resource_overrides ,
1084+ description = description ,
1085+ enable_profiling = enable_profiling ,
1086+ enable_profiling_torch = enable_profiling_torch ,
10721087 )
10731088 provider_id = provider .get ("id" )
10741089
@@ -1105,6 +1120,16 @@ def command_task_queue(
11051120 "scalar (e.g. score=0.42 -> float, enabled=true -> bool). Unknown keys fail."
11061121 ),
11071122 ),
1123+ enable_profiling : bool = typer .Option (
1124+ False ,
1125+ "--enable-profiling" ,
1126+ help = "Enable system profiling for this run (CPU/GPU/memory sampling)." ,
1127+ ),
1128+ enable_profiling_torch : bool = typer .Option (
1129+ False ,
1130+ "--enable-profiling-torch" ,
1131+ help = "Enable torch profiler trace export for this run (requires --enable-profiling)." ,
1132+ ),
11081133):
11091134 """Queue a task on a compute provider."""
11101135 current_experiment = require_current_experiment ()
@@ -1119,6 +1144,8 @@ def command_task_queue(
11191144 interactive = not no_interactive ,
11201145 description = description ,
11211146 param_overrides = param_overrides ,
1147+ enable_profiling = enable_profiling ,
1148+ enable_profiling_torch = enable_profiling_torch ,
11221149 )
11231150
11241151
0 commit comments