@@ -3,7 +3,9 @@ use crate::client::commands::duration_doc;
33use crate :: client:: commands:: submit:: directives:: parse_hq_directives_from_file;
44use crate :: client:: commands:: wait:: { wait_for_jobs, wait_for_jobs_with_progress} ;
55use crate :: client:: globalsettings:: GlobalSettings ;
6- use crate :: client:: resources:: { parse_allocation_request, parse_resource_request} ;
6+ use crate :: client:: resources:: {
7+ parse_allocation_request, parse_resource_request, parse_resource_weight,
8+ } ;
79use crate :: common:: arraydef:: IntArray ;
810use crate :: common:: cli:: OptsWithMatches ;
911use crate :: common:: parser2:: { CharParser , ParseError , all_consuming} ;
@@ -43,7 +45,9 @@ use tako::gateway::{
4345 ResourceRequestVariants ,
4446} ;
4547use tako:: program:: { FileOnCloseBehavior , ProgramDefinition , StdioDef } ;
46- use tako:: resources:: { AllocationRequest , CPU_RESOURCE_NAME , NumOfNodes , ResourceAmount } ;
48+ use tako:: resources:: {
49+ AllocationRequest , CPU_RESOURCE_NAME , NumOfNodes , ResourceAmount , ResourceWeight ,
50+ } ;
4751use tako:: { JobId , JobTaskCount , Map , UserPriority } ;
4852
4953const SUBMIT_ARRAY_LIMIT : JobTaskCount = 999 ;
@@ -238,6 +242,13 @@ pub struct SubmitJobTaskConfOpts {
238242 ) ]
239243 time_request : Duration ,
240244
245+ /// Resource weight
246+ ///
247+ /// Weight of resource request within main scheduler.
248+ /// Resource weight has to be a positive number.
249+ #[ arg( long, value_parser = parse_resource_weight) ]
250+ weight : Option < ResourceWeight > ,
251+
241252 /// Pins the job to the cores specified in `--cpus`
242253 #[ arg( long, value_enum) ]
243254 pin : Option < PinModeArg > ,
@@ -360,6 +371,7 @@ impl OptsWithMatches<SubmitJobTaskConfOpts> {
360371 cpus : opts. cpus . or ( other_opts. cpus ) ,
361372 resource,
362373 time_request : get_or_default ( & self_matches, & other_matches, "time_request" ) ,
374+ weight : opts. weight ,
363375 pin : opts. pin . or ( other_opts. pin ) ,
364376 task_dir : opts. task_dir || other_opts. task_dir ,
365377 cwd : opts. cwd . or ( other_opts. cwd ) ,
@@ -533,6 +545,7 @@ impl JobSubmitOpts {
533545 n_nodes : self . conf . nodes ,
534546 min_time : self . conf . time_request ,
535547 resources,
548+ weight : self . conf . weight . unwrap_or_default ( ) ,
536549 } ;
537550 request. validate ( ) ?;
538551 Ok ( request)
@@ -668,6 +681,7 @@ pub async fn submit_computation(
668681 nodes : _,
669682 cpus : _,
670683 resource : _,
684+ weight : _,
671685 time_request : _,
672686 pin,
673687 task_dir,
0 commit comments