Skip to content

Commit c19902d

Browse files
committed
update to new firecrest spec
1 parent c826826 commit c19902d

5 files changed

Lines changed: 30 additions & 17 deletions

File tree

coman/src/cli/app.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ use chrono::{DateTime, Local, TimeDelta};
44
use clap::{Args, Command, Parser, Subcommand, ValueHint, builder::TypedValueParser};
55
use clap_complete::{ArgValueCompleter, CompletionCandidate, Generator, Shell, generate};
66
use color_eyre::{Report, Result};
7+
use eyre::Context;
78
use itertools::Itertools;
8-
use self_update::cargo_crate_version;
9+
use self_update::{cargo_crate_version, errors::Error as UpdateError};
910
use strum::VariantNames;
1011
use tokio::sync::mpsc;
1112

@@ -565,21 +566,27 @@ pub fn print_completions<G: Generator>(generator: G, cmd: &mut Command) {
565566
}
566567

567568
pub fn update() -> Result<()> {
568-
let status = self_update::backends::github::Update::configure()
569+
let result = self_update::backends::github::Update::configure()
569570
.repo_owner("SwissDataScienceCenter")
570571
.repo_name("coman")
571572
.bin_name("coman")
572573
.bin_path_in_archive("coman")
573574
.show_download_progress(true)
574575
.current_version(cargo_crate_version!())
575576
.build()?
576-
.update()?;
577-
if status.updated() {
578-
println!("Successfully updated to version: `{}`", status.version());
579-
} else {
580-
println!("Already up to date at version: `{}`", status.version());
577+
.update();
578+
match result {
579+
Ok(status) => {
580+
if status.updated() {
581+
println!("Successfully updated to version: `{}`", status.version());
582+
} else {
583+
println!("Already up to date at version: `{}`", status.version());
584+
}
585+
Ok(())
586+
}
587+
Err(UpdateError::Update(msg)) if msg == "Update aborted" => Ok(()),
588+
Err(e) => Err(e).wrap_err("couldn't perform update"),
581589
}
582-
Ok(())
583590
}
584591

585592
pub async fn check_update() -> Result<()> {

coman/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ pub struct SystemDescription {
4040
#[allow(clippy::upper_case_acronyms)]
4141
pub enum ComputePlatform {
4242
#[default]
43+
#[serde(alias = "hpc", alias = "HPC")]
4344
HPC,
45+
#[serde(alias = "ml", alias = "ML")]
4446
ML,
47+
#[serde(alias = "cw", alias = "CW")]
4548
CW,
4649
}
4750

coman/src/cscs/api_client/client.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ mod tests {
293293
Result<PostJobSubmissionResponse>
294294
))
295295
.will_return_async(injectorpp::async_return!(
296-
Ok(PostJobSubmissionResponse { job_id: Some(1) }),
296+
Ok(PostJobSubmissionResponse {
297+
job_id: Some("1".to_owned())
298+
}),
297299
Result<PostJobSubmissionResponse>
298300
));
299301
let result = client
@@ -473,7 +475,7 @@ mod tests {
473475
.will_return_async(injectorpp::async_return!(
474476
Ok(UploadFileResponse {
475477
transfer_job: TransferJob {
476-
job_id: 1,
478+
job_id: "1".to_owned(),
477479
..Default::default()
478480
},
479481
transfer_directives: DownloadFileResponseTransferDirectives::S3(S3TransferResponse {
@@ -507,7 +509,7 @@ mod tests {
507509
.will_return_async(injectorpp::async_return!(
508510
Ok(DownloadFileResponse {
509511
transfer_job: TransferJob {
510-
job_id: 1,
512+
job_id: "1".to_owned(),
511513
..Default::default()
512514
},
513515
transfer_directives: DownloadFileResponseTransferDirectives::S3(S3TransferResponse {

firecrest_client/src/types.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ pub type AttachComputeSystemNameJobsJobIdAttachPutRequestBody = PostJobAttachReq
8888
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
8989
pub struct BodyPostUploadFilesystemSystemNameOpsUploadPost {
9090
///File to be uploaded as `multipart/form-data`
91-
pub file: Vec<u8>,
91+
#[validate(length(min = 1u64))]
92+
pub file: String,
9293
}
9394
///Configuration for automatic object lifecycle in storage buckets.
9495
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
@@ -2382,7 +2383,7 @@ pub struct PostJobAttachRequest {
23822383
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
23832384
pub struct PostJobSubmissionResponse {
23842385
#[serde(rename = "jobId")]
2385-
pub job_id: Option<i64>,
2386+
pub job_id: Option<String>,
23862387
}
23872388
///Submit a new job
23882389
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
@@ -3063,7 +3064,7 @@ pub struct StreamerTransferResponse {
30633064
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
30643065
pub struct TransferJob {
30653066
#[serde(rename = "jobId")]
3066-
pub job_id: i64,
3067+
pub job_id: String,
30673068
pub logs: TransferJobLogs,
30683069
pub system: String,
30693070
#[serde(rename = "workingDirectory")]

openapi_spec/firecrest_3.1.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ components:
3434
Body_post_upload_filesystem__system_name__ops_upload_post:
3535
properties:
3636
file:
37+
contentMediaType: application/octet-stream
3738
description: File to be uploaded as `multipart/form-data`
38-
format: binary
3939
title: File
4040
type: string
4141
required:
@@ -1395,7 +1395,7 @@ components:
13951395
properties:
13961396
jobId:
13971397
anyOf:
1398-
- type: integer
1398+
- type: string
13991399
- type: "null"
14001400
nullable: true
14011401
title: Jobid
@@ -2074,7 +2074,7 @@ components:
20742074
properties:
20752075
jobId:
20762076
title: Jobid
2077-
type: integer
2077+
type: string
20782078
logs:
20792079
$ref: "#/components/schemas/TransferJobLogs"
20802080
system:

0 commit comments

Comments
 (0)