@@ -356,63 +356,50 @@ pub async fn process_instance(
356356 // We only print
357357 if result != FullValue :: Void {
358358 println ! ( "\n Workflow returned value {}" , style( format!( "'{result}'" ) ) . bold( ) . cyan( ) ) ;
359+ }
359360
360- // Treat some values special
361- match result {
362- // Print sommat additional if it's an intermediate result.
363- FullValue :: IntermediateResult ( _) => {
364- println ! ( "(Intermediate results are not available locally; promote it using 'commit_result()')" ) ;
365- } ,
366-
367- // If it's a dataset, attempt to download it
368- FullValue :: Data ( name) => {
369- // Compute the directory to write to
370- let data_dir: PathBuf = datasets_dir. join ( name. to_string ( ) ) ;
371-
372- // Fetch a new, local DataIndex to get up-to-date entries
373- let data_addr: String = format ! ( "{api_endpoint}/data/info" ) ;
374- let index: DataIndex = match brane_tsk:: api:: get_data_index ( & data_addr) . await {
375- Ok ( dindex) => dindex,
376- Err ( err) => {
377- return Err ( Error :: RemoteDataIndexError { address : data_addr, err } ) ;
378- } ,
379- } ;
361+ // Treat some values special
362+ match result {
363+ // Print sommat additional if it's an intermediate result.
364+ FullValue :: IntermediateResult ( _) => {
365+ println ! ( "(Intermediate results are not available locally; promote it using 'commit_result()')" ) ;
366+ } ,
380367
381- // Fetch the method of its availability
382- let info: & DataInfo = match index. get ( & name) {
383- Some ( info) => info,
384- None => {
385- return Err ( Error :: UnknownDataset { name : name. into ( ) } ) ;
386- } ,
387- } ;
388- let access: AccessKind = match info. access . get ( LOCALHOST ) {
389- Some ( access) => access. clone ( ) ,
390- None => {
391- // Attempt to download it instead
392- match data:: download_data ( api_endpoint, proxy_addr, certs_dir, data_dir, & name, & info. access ) . await {
393- Ok ( Some ( access) ) => access,
394- Ok ( None ) => {
395- return Err ( Error :: UnavailableDataset { name : name. into ( ) , locs : info. access . keys ( ) . cloned ( ) . collect ( ) } ) ;
396- } ,
397- Err ( err) => {
398- return Err ( Error :: DataDownloadError { err } ) ;
399- } ,
400- }
401- } ,
402- } ;
368+ // If it's a dataset, attempt to download it
369+ FullValue :: Data ( name) => {
370+ // Compute the directory to write to
371+ let data_dir: PathBuf = datasets_dir. join ( name. to_string ( ) ) ;
372+
373+ // Fetch a new, local DataIndex to get up-to-date entries
374+ let data_addr: String = format ! ( "{api_endpoint}/data/info" ) ;
375+ let index: DataIndex =
376+ brane_tsk:: api:: get_data_index ( & data_addr) . await . map_err ( |err| Error :: RemoteDataIndexError { address : data_addr, err } ) ?;
377+
378+ // Fetch the method of its availability
379+ let info: & DataInfo = index. get ( & name) . ok_or_else ( || Error :: UnknownDataset { name : name. clone ( ) . into ( ) } ) ?;
380+
381+ let access: AccessKind = match info. access . get ( LOCALHOST ) . cloned ( ) {
382+ Some ( access) => access,
383+ None => {
384+ // Attempt to download it instead
385+ data:: download_data ( api_endpoint, proxy_addr, certs_dir, data_dir, & name, & info. access )
386+ . await
387+ . map_err ( |source| Error :: DataDownloadError { err : source } ) ?
388+ . ok_or_else ( || Error :: UnavailableDataset { name : name. into ( ) , locs : info. access . keys ( ) . cloned ( ) . collect ( ) } ) ?
389+ } ,
390+ } ;
403391
404- // Write the method of access
405- match access {
406- AccessKind :: File { path } => println ! ( "(It's available under '{}')" , path. display( ) ) ,
407- }
408- } ,
392+ // Write the method of access
393+ match access {
394+ AccessKind :: File { path } => println ! ( "(It's available under '{}')" , path. display( ) ) ,
395+ }
396+ } ,
409397
410- // Nothing for the rest
411- _ => { } ,
412- }
398+ // Nothing for the rest
399+ _ => { } ,
413400 }
414401
415- // DOne
402+ // Done
416403 Ok ( ( ) )
417404}
418405
0 commit comments