@@ -146,6 +146,7 @@ pub async fn cscs_job_cancel(job_id: i64, system: Option<String>, platform: Opti
146146 }
147147}
148148
149+ #[ allow( clippy:: too_many_arguments) ]
149150pub async fn cscs_start_job (
150151 script_file : Option < PathBuf > ,
151152 image : Option < DockerImageUrl > ,
@@ -154,12 +155,14 @@ pub async fn cscs_start_job(
154155 env : Vec < ( String , String ) > ,
155156 system : Option < String > ,
156157 platform : Option < ComputePlatform > ,
158+ account : Option < String > ,
157159) -> Result < ( ) > {
158160 match get_access_token ( ) . await {
159161 Ok ( access_token) => {
160162 let api_client = CscsApi :: new ( access_token. 0 , platform) . unwrap ( ) ;
161163 let config = Config :: new ( ) . unwrap ( ) ;
162164 let current_system = & system. unwrap_or ( config. cscs . current_system ) ;
165+ let account = account. or ( config. cscs . account ) ;
163166 let user_info = api_client. get_userinfo ( current_system) . await ?;
164167 let current_system_info = api_client. get_system ( current_system) . await ?;
165168 let scratch = match current_system_info {
@@ -245,7 +248,7 @@ pub async fn cscs_start_job(
245248
246249 // start job
247250 api_client
248- . start_job ( current_system, & name, script_path, envvars)
251+ . start_job ( current_system, account , & name, script_path, envvars)
249252 . await ?;
250253 Ok ( ( ) )
251254 }
@@ -295,9 +298,8 @@ pub async fn cscs_file_download(
295298 Ok ( None )
296299 } else {
297300 // download via s3
298- let job_data = api_client
299- . transfer_download ( current_system, & account. unwrap_or ( config. cscs . account ) , remote)
300- . await ?;
301+ let account = account. or ( config. cscs . account ) ;
302+ let job_data = api_client. transfer_download ( current_system, account, remote) . await ?;
301303 Ok ( Some ( ( job_data. 0 , job_data. 1 , size) ) )
302304 }
303305 }
@@ -333,13 +335,9 @@ pub async fn cscs_file_upload(
333335 Ok ( None )
334336 } else {
335337 // upload via s3
338+ let account = account. or ( config. cscs . account ) ;
336339 let transfer_data = api_client
337- . transfer_upload (
338- & config. cscs . current_system ,
339- & account. unwrap_or ( config. cscs . account ) ,
340- remote,
341- size as i64 ,
342- )
340+ . transfer_upload ( & config. cscs . current_system , account, remote, size as i64 )
343341 . await ?;
344342
345343 Ok ( Some ( transfer_data) )
0 commit comments