Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(*): Use proper attributes for clap derives #4751

Merged
merged 17 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions crates/iota-analytics-indexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,94 +65,94 @@ const DYNAMIC_FIELD_PREFIX: &str = "dynamic_field";
const WRAPPED_OBJECT_PREFIX: &str = "wrapped_object";

#[derive(Parser, Clone, Debug)]
#[clap(
#[command(
name = "IOTA Analytics Indexer",
about = "Indexer service to upload data for the analytics pipeline.",
rename_all = "kebab-case"
)]
pub struct AnalyticsIndexerConfig {
/// The url of the checkpoint client to connect to.
#[clap(long)]
#[arg(long)]
pub rest_url: String,
/// The url of the metrics client to connect to.
#[clap(long, default_value = "127.0.0.1", global = true)]
#[arg(long, default_value = "127.0.0.1", global = true)]
pub client_metric_host: String,
/// The port of the metrics client to connect to.
#[clap(long, default_value = "8081", global = true)]
#[arg(long, default_value = "8081", global = true)]
pub client_metric_port: u16,
/// Directory to contain the temporary files for checkpoint entries.
#[clap(long, global = true, default_value = "/tmp")]
#[arg(long, global = true, default_value = "/tmp")]
pub checkpoint_dir: PathBuf,
/// Number of checkpoints to process before uploading to the datastore.
#[clap(long, default_value = "10000", global = true)]
#[arg(long, default_value = "10000", global = true)]
pub checkpoint_interval: u64,
/// Maximum file size in mb before uploading to the datastore.
#[clap(long, default_value = "100", global = true)]
#[arg(long, default_value = "100", global = true)]
pub max_file_size_mb: u64,
/// Checkpoint sequence number to start the download from
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub starting_checkpoint_seq_num: Option<u64>,
/// Time to process in seconds before uploading to the datastore.
#[clap(long, default_value = "600", global = true)]
#[arg(long, default_value = "600", global = true)]
pub time_interval_s: u64,
// Remote object store where data gets written to
#[command(flatten)]
pub remote_store_config: ObjectStoreConfig,
// Remote object store path prefix to use while writing
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub remote_store_path_prefix: Option<Path>,
// File format to store data in i.e. csv, parquet, etc
#[clap(long, value_enum, default_value = "csv", global = true)]
#[arg(long, value_enum, default_value = "csv", global = true)]
pub file_format: FileFormat,
// Type of data to write i.e. checkpoint, object, transaction, etc
#[clap(long, value_enum, long, global = true)]
#[arg(long, value_enum, long, global = true)]
pub file_type: FileType,
#[clap(
#[arg(
long,
default_value = "https://checkpoints.mainnet.iota.cafe",
global = true
)]
pub remote_store_url: String,
// Directory to contain the package cache for pipelines
#[clap(
#[arg(
long,
value_enum,
long,
global = true,
default_value = "/opt/iota/db/package_cache"
)]
pub package_cache_path: PathBuf,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub bq_service_account_key_file: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub bq_project_id: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub bq_dataset_id: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub bq_table_id: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub bq_checkpoint_col_id: Option<String>,
#[clap(long, global = true)]
#[arg(long, global = true)]
pub report_bq_max_table_checkpoint: bool,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub sf_account_identifier: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub sf_warehouse: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub sf_database: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub sf_schema: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub sf_username: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub sf_role: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub sf_password: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub sf_table_id: Option<String>,
#[clap(long, default_value = None, global = true)]
#[arg(long, default_value = None, global = true)]
pub sf_checkpoint_col_id: Option<String>,
#[clap(long, global = true)]
#[arg(long, global = true)]
pub report_sf_max_table_checkpoint: bool,
}

Expand Down
52 changes: 26 additions & 26 deletions crates/iota-aws-orchestrator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct Opts {
/// The path to the settings file. This file contains basic information to
/// deploy testbeds and run benchmarks such as the url of the git repo,
/// the commit to deploy, etc.
#[clap(
#[arg(
long,
value_name = "FILE",
default_value = "crates/iota-aws-orchestrator/assets/settings.json",
Expand All @@ -48,95 +48,95 @@ pub struct Opts {
settings_path: String,

/// The type of operation to run.
#[clap(subcommand)]
#[command(subcommand)]
operation: Operation,
}

#[derive(Parser)]
pub enum Operation {
/// Get or modify the status of the testbed.
Testbed {
#[clap(subcommand)]
#[command(subcommand)]
action: TestbedAction,
},

/// Run a benchmark on the specified testbed.
Benchmark {
/// Percentage of shared vs owned objects; 0 means only owned objects
/// and 100 means only shared objects.
#[clap(long, default_value = "0", global = true)]
#[arg(long, default_value = "0", global = true)]
benchmark_type: String,

/// The committee size to deploy.
#[clap(long, value_name = "INT")]
#[arg(long, value_name = "INT")]
committee: usize,

/// Number of faulty nodes.
#[clap(long, value_name = "INT", default_value = "0", global = true)]
#[arg(long, value_name = "INT", default_value = "0", global = true)]
faults: usize,

/// Whether the faulty nodes recover.
#[clap(long, action, default_value = "false", global = true)]
#[arg(long, action, default_value = "false", global = true)]
crash_recovery: bool,

/// The interval to crash nodes in seconds.
#[clap(long, value_parser = parse_duration, default_value = "60", global = true)]
#[arg(long, value_parser = parse_duration, default_value = "60", global = true)]
crash_interval: Duration,

/// The minimum duration of the benchmark in seconds.
#[clap(long, value_parser = parse_duration, default_value = "600", global = true)]
#[arg(long, value_parser = parse_duration, default_value = "600", global = true)]
duration: Duration,

/// The interval between measurements collection in seconds.
#[clap(long, value_parser = parse_duration, default_value = "15", global = true)]
#[arg(long, value_parser = parse_duration, default_value = "15", global = true)]
scrape_interval: Duration,

/// Whether to skip testbed updates before running benchmarks.
#[clap(long, action, default_value = "false", global = true)]
#[arg(long, action, default_value = "false", global = true)]
skip_testbed_update: bool,

/// Whether to skip testbed configuration before running benchmarks.
#[clap(long, action, default_value = "false", global = true)]
#[arg(long, action, default_value = "false", global = true)]
skip_testbed_configuration: bool,

/// Whether to download and analyze the client and node log files.
#[clap(long, action, default_value = "false", global = true)]
#[arg(long, action, default_value = "false", global = true)]
log_processing: bool,

/// The number of instances running exclusively load generators. If set
/// to zero the orchestrator collocates one load generator with
/// each node.
#[clap(long, value_name = "INT", default_value = "0", global = true)]
#[arg(long, value_name = "INT", default_value = "0", global = true)]
dedicated_clients: usize,

/// Whether to forgo a grafana and prometheus instance and leave the
/// testbed unmonitored.
#[clap(long, action, default_value = "false", global = true)]
#[arg(long, action, default_value = "false", global = true)]
skip_monitoring: bool,

/// The timeout duration for ssh commands (in seconds).
#[clap(long, action, value_parser = parse_duration, default_value = "30", global = true)]
#[arg(long, action, value_parser = parse_duration, default_value = "30", global = true)]
timeout: Duration,

/// The number of times the orchestrator should retry an ssh command.
#[clap(long, value_name = "INT", default_value = "5", global = true)]
#[arg(long, value_name = "INT", default_value = "5", global = true)]
retries: usize,

/// The load to submit to the system.
#[clap(subcommand)]
#[command(subcommand)]
load_type: Load,
},

/// Print a summary of the specified measurements collection.
Summarize {
/// The path to the settings file.
#[clap(long, value_name = "FILE")]
#[arg(long, value_name = "FILE")]
path: String,
},
}

#[derive(Parser)]
#[clap(rename_all = "kebab-case")]
#[command(rename_all = "kebab-case")]
pub enum TestbedAction {
/// Display the testbed status.
Status,
Expand All @@ -145,21 +145,21 @@ pub enum TestbedAction {
/// the setting file.
Deploy {
/// Number of instances to deploy.
#[clap(long)]
#[arg(long)]
instances: usize,

/// The region where to deploy the instances. If this parameter is not
/// specified, the command deploys the specified number of
/// instances in all regions listed in the setting file.
#[clap(long)]
#[arg(long)]
region: Option<String>,
},

/// Start at most the specified number of instances per region on an
/// existing testbed.
Start {
/// Number of instances to deploy.
#[clap(long, default_value = "200")]
#[arg(long, default_value = "200")]
instances: usize,
},

Expand All @@ -175,7 +175,7 @@ pub enum Load {
/// The fixed loads (in tx/s) to submit to the nodes.
FixedLoad {
/// A list of fixed load (tx/s).
#[clap(
#[arg(
long,
value_name = "INT",
num_args(1..),
Expand All @@ -187,11 +187,11 @@ pub enum Load {
/// Search for the maximum load that the system can sustainably handle.
Search {
/// The initial load (in tx/s) to test and use a baseline.
#[clap(long, value_name = "INT", default_value = "250")]
#[arg(long, value_name = "INT", default_value = "250")]
starting_load: usize,
/// The maximum number of iterations before converging on a breaking
/// point.
#[clap(long, value_name = "INT", default_value = "5")]
#[arg(long, value_name = "INT", default_value = "5")]
max_iterations: usize,
},
}
Expand Down
Loading
Loading