Skip to content

Commit

Permalink
fix: fix infra artifacts dockerfiles, wf commands
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato committed Oct 24, 2024
1 parent dc823b6 commit f8376d5
Show file tree
Hide file tree
Showing 13 changed files with 207 additions and 143 deletions.
12 changes: 1 addition & 11 deletions .vscode/rivet.code-workspace
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
{
"folders": [
{
"path": "..",
},
{
"path": "../lib/bolt",
},
{
"path": "../svc",
}
],
"folders": []
}
40 changes: 25 additions & 15 deletions packages/cli/src/commands/wf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ mod signal;

#[derive(Parser)]
pub enum SubCommand {
/// Prints the given workflow.
/// Prints the given workflow(s).
Get {
#[clap(index = 1)]
workflow_id: Uuid,
workflow_ids: Vec<Uuid>,
},
/// Finds workflows with the given tags, name and state.
List {
Expand All @@ -30,20 +29,23 @@ pub enum SubCommand {
},
/// Silences a workflow from showing up as dead or running again.
Ack {
#[clap(index = 1)]
workflow_id: Uuid,
workflow_ids: Vec<Uuid>,
},
/// Sets the wake immediate property of a workflow to true.
Wake {
#[clap(index = 1)]
workflow_id: Uuid,
workflow_ids: Vec<Uuid>,
},
/// Lists the entire event history of a workflow.
History {
#[clap(index = 1)]
workflow_id: Uuid,
/// Includes activity errors in graph.
#[clap(short = 'e', long)]
include_errors: bool,
/// Includes forgotten events in graph, shown in red.
#[clap(short = 'f', long)]
include_forgotten: bool,
/// Includes location numbers for events in graph.
#[clap(short = 'l', long)]
print_location: bool,
},
Expand All @@ -56,10 +58,10 @@ pub enum SubCommand {
impl SubCommand {
pub async fn execute(self, config: rivet_config::Config) -> Result<()> {
match self {
Self::Get { workflow_id } => {
Self::Get { workflow_ids } => {
let pool = util::wf::build_pool(&config).await?;
let workflow = util::wf::get_workflow(pool, workflow_id).await?;
util::wf::print_workflows(workflow.into_iter().collect(), true).await
let workflows = util::wf::get_workflows(pool, workflow_ids).await?;
util::wf::print_workflows(workflows, true).await
}
Self::List {
tags,
Expand All @@ -71,21 +73,29 @@ impl SubCommand {
let workflows = util::wf::find_workflows(pool, tags, name, state).await?;
util::wf::print_workflows(workflows, pretty).await
}
Self::Ack { workflow_id } => {
Self::Ack { workflow_ids } => {
let pool = util::wf::build_pool(&config).await?;
util::wf::silence_workflow(pool, workflow_id).await
util::wf::silence_workflows(pool, workflow_ids).await
}
Self::Wake { workflow_id } => {
Self::Wake { workflow_ids } => {
let pool = util::wf::build_pool(&config).await?;
util::wf::wake_workflow(pool, workflow_id).await
util::wf::wake_workflows(pool, workflow_ids).await
}
Self::History {
workflow_id,
include_errors,
include_forgotten,
print_location,
} => {
let pool = util::wf::build_pool(&config).await?;
util::wf::print_history(pool, workflow_id, include_forgotten, print_location).await
util::wf::print_history(
pool,
workflow_id,
include_errors,
include_forgotten,
print_location,
)
.await
}
Self::Signal { command } => command.execute(config).await,
}
Expand Down
18 changes: 8 additions & 10 deletions packages/cli/src/commands/wf/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ use crate::util::{

#[derive(Parser)]
pub enum SubCommand {
/// Prints the given signal.
/// Prints the given signal(s).
Get {
#[clap(index = 1)]
signal_id: Uuid,
signal_ids: Vec<Uuid>,
},
/// Finds signals that match the given tags.
List {
Expand All @@ -30,18 +29,17 @@ pub enum SubCommand {
},
/// Silences a signal from showing up as dead or running again.
Ack {
#[clap(index = 1)]
signal_id: Uuid,
signal_ids: Vec<Uuid>,
},
}

impl SubCommand {
pub async fn execute(self, config: rivet_config::Config) -> Result<()> {
match self {
Self::Get { signal_id } => {
Self::Get { signal_ids } => {
let pool = util::wf::build_pool(&config).await?;
let signal = util::wf::signal::get_signal(pool, signal_id).await?;
util::wf::signal::print_signals(signal.into_iter().collect(), true).await
let signals = util::wf::signal::get_signals(pool, signal_ids).await?;
util::wf::signal::print_signals(signals, true).await
}
Self::List {
tags,
Expand All @@ -55,9 +53,9 @@ impl SubCommand {
util::wf::signal::find_signals(pool, tags, workflow_id, name, state).await?;
util::wf::signal::print_signals(signals, pretty).await
}
Self::Ack { signal_id } => {
Self::Ack { signal_ids } => {
let pool = util::wf::build_pool(&config).await?;
util::wf::signal::silence_signal(pool, signal_id).await
util::wf::signal::silence_signals(pool, signal_ids).await
}
}
}
Expand Down
Loading

0 comments on commit f8376d5

Please sign in to comment.