@@ -16,6 +16,7 @@ use tokio::{
1616} ;
1717
1818use crate :: {
19+ config:: ComputePlatform ,
1920 cscs:: {
2021 api_client:: JobStatus ,
2122 handlers:: {
@@ -38,8 +39,8 @@ pub(crate) async fn cli_cscs_login() -> Result<()> {
3839 } ;
3940 Ok ( ( ) )
4041}
41- pub ( crate ) async fn cli_cscs_job_list ( ) -> Result < ( ) > {
42- match cscs_job_list ( ) . await {
42+ pub ( crate ) async fn cli_cscs_job_list ( system : Option < String > , platform : Option < ComputePlatform > ) -> Result < ( ) > {
43+ match cscs_job_list ( system , platform ) . await {
4344 Ok ( jobs) => {
4445 let mut table = tabled:: Table :: new ( jobs) ;
4546 table. with ( tabled:: settings:: Style :: modern ( ) ) ;
@@ -49,8 +50,12 @@ pub(crate) async fn cli_cscs_job_list() -> Result<()> {
4950 Err ( e) => Err ( e) ,
5051 }
5152}
52- pub ( crate ) async fn cli_cscs_job_detail ( job_id : i64 ) -> Result < ( ) > {
53- match cscs_job_details ( job_id) . await {
53+ pub ( crate ) async fn cli_cscs_job_detail (
54+ job_id : i64 ,
55+ system : Option < String > ,
56+ platform : Option < ComputePlatform > ,
57+ ) -> Result < ( ) > {
58+ match cscs_job_details ( job_id, system, platform) . await {
5459 Ok ( Some ( job) ) => {
5560 let data = & [
5661 ( "Id" , job. id . to_string ( ) ) ,
@@ -80,8 +85,12 @@ pub(crate) async fn cli_cscs_job_detail(job_id: i64) -> Result<()> {
8085 }
8186}
8287
83- pub ( crate ) async fn cli_cscs_job_log ( job_id : i64 ) -> Result < ( ) > {
84- match cscs_job_log ( job_id) . await {
88+ pub ( crate ) async fn cli_cscs_job_log (
89+ job_id : i64 ,
90+ system : Option < String > ,
91+ platform : Option < ComputePlatform > ,
92+ ) -> Result < ( ) > {
93+ match cscs_job_log ( job_id, system, platform) . await {
8594 Ok ( content) => {
8695 println ! ( "{}" , content) ;
8796 Ok ( ( ) )
@@ -96,16 +105,22 @@ pub(crate) async fn cli_cscs_job_start(
96105 command : Option < Vec < String > > ,
97106 workdir : Option < String > ,
98107 env : Vec < ( String , String ) > ,
108+ system : Option < String > ,
109+ platform : Option < ComputePlatform > ,
99110) -> Result < ( ) > {
100- cscs_start_job ( script_file, image, command, workdir, env) . await
111+ cscs_start_job ( script_file, image, command, workdir, env, system , platform ) . await
101112}
102113
103- pub ( crate ) async fn cli_cscs_job_cancel ( job_id : i64 ) -> Result < ( ) > {
104- cscs_job_cancel ( job_id) . await
114+ pub ( crate ) async fn cli_cscs_job_cancel (
115+ job_id : i64 ,
116+ system : Option < String > ,
117+ platform : Option < ComputePlatform > ,
118+ ) -> Result < ( ) > {
119+ cscs_job_cancel ( job_id, system, platform) . await
105120}
106121
107- pub ( crate ) async fn cli_cscs_system_list ( ) -> Result < ( ) > {
108- match cscs_system_list ( ) . await {
122+ pub ( crate ) async fn cli_cscs_system_list ( platform : Option < ComputePlatform > ) -> Result < ( ) > {
123+ match cscs_system_list ( platform ) . await {
109124 Ok ( systems) => {
110125 let mut table = tabled:: Table :: new ( systems) ;
111126 table. with ( tabled:: settings:: Style :: modern ( ) ) ;
@@ -119,8 +134,12 @@ pub(crate) async fn cli_cscs_set_system(system_name: String, global: bool) -> Re
119134 cscs_system_set ( system_name, global) . await
120135}
121136
122- pub ( crate ) async fn cli_cscs_file_list ( path : PathBuf ) -> Result < ( ) > {
123- match cscs_file_list ( path) . await {
137+ pub ( crate ) async fn cli_cscs_file_list (
138+ path : PathBuf ,
139+ system : Option < String > ,
140+ platform : Option < ComputePlatform > ,
141+ ) -> Result < ( ) > {
142+ match cscs_file_list ( path, system, platform) . await {
124143 Ok ( path_entries) => {
125144 let mut table = tabled:: Table :: new ( path_entries) ;
126145 table. with ( tabled:: settings:: Style :: empty ( ) ) ;
@@ -131,8 +150,14 @@ pub(crate) async fn cli_cscs_file_list(path: PathBuf) -> Result<()> {
131150 }
132151}
133152
134- pub ( crate ) async fn cli_cscs_file_download ( remote : PathBuf , local : PathBuf , account : Option < String > ) -> Result < ( ) > {
135- match cscs_file_download ( remote, local. clone ( ) , account) . await {
153+ pub ( crate ) async fn cli_cscs_file_download (
154+ remote : PathBuf ,
155+ local : PathBuf ,
156+ account : Option < String > ,
157+ system : Option < String > ,
158+ platform : Option < ComputePlatform > ,
159+ ) -> Result < ( ) > {
160+ match cscs_file_download ( remote, local. clone ( ) , account, system. clone ( ) , platform. clone ( ) ) . await {
136161 Ok ( None ) => {
137162 println ! ( "File successfully downloaded" ) ;
138163 Ok ( ( ) )
@@ -143,7 +168,7 @@ pub(crate) async fn cli_cscs_file_download(remote: PathBuf, local: PathBuf, acco
143168 println ! ( "started s3 transfer job {}" , job_data. 0 ) ;
144169 let mut transfer_done = false ;
145170 while !transfer_done {
146- if let Some ( job) = cscs_job_details ( job_data. 0 ) . await ? {
171+ if let Some ( job) = cscs_job_details ( job_data. 0 , system . clone ( ) , platform . clone ( ) ) . await ? {
147172 match job. status {
148173 JobStatus :: Pending | JobStatus :: Running => { }
149174 JobStatus :: Finished => transfer_done = true ,
@@ -182,8 +207,14 @@ pub(crate) async fn cli_cscs_file_download(remote: PathBuf, local: PathBuf, acco
182207 }
183208}
184209
185- pub ( crate ) async fn cli_cscs_file_upload ( local : PathBuf , remote : PathBuf , account : Option < String > ) -> Result < ( ) > {
186- match cscs_file_upload ( local. clone ( ) , remote, account) . await {
210+ pub ( crate ) async fn cli_cscs_file_upload (
211+ local : PathBuf ,
212+ remote : PathBuf ,
213+ account : Option < String > ,
214+ system : Option < String > ,
215+ platform : Option < ComputePlatform > ,
216+ ) -> Result < ( ) > {
217+ match cscs_file_upload ( local. clone ( ) , remote, account, system, platform) . await {
187218 Ok ( None ) => {
188219 println ! ( "File successfully uploaded" ) ;
189220 Ok ( ( ) )
0 commit comments