qualia_cli/handlers/
qpu.rs1use crate::cli::QpuAction;
2use crate::qpu;
3
4pub fn handle(action: &QpuAction, enable_qpu: bool) {
6 if !enable_qpu {
7 eprintln!("QPU commands require the --enable-qpu flag:");
8 eprintln!(" qualia-cli --enable-qpu qpu <subcommand>");
9 eprintln!();
10 eprintln!(
11 "Subcommands: list-providers | configure | show | clear | test-connection | submit"
12 );
13 std::process::exit(1);
14 }
15 let data_dir = std::env::var("QUALIA_DATA_DIR").unwrap_or_else(|_| ".".to_string());
16 match action {
17 QpuAction::ListProviders => {
18 qpu::run_list_providers();
19 }
20 QpuAction::Configure {
21 provider,
22 api_key,
23 endpoint,
24 hub,
25 group,
26 project,
27 instance,
28 subscription_id,
29 resource_group,
30 workspace,
31 location,
32 access_key_id,
33 secret_access_key,
34 region,
35 s3_bucket,
36 project_id,
37 processor_id,
38 service_account_key_path,
39 user_id,
40 qpu_id,
41 backend,
42 machine,
43 } => {
44 qpu::run_configure(
45 &data_dir,
46 provider,
47 api_key.as_deref(),
48 endpoint.as_deref(),
49 hub.as_deref(),
50 group.as_deref(),
51 project.as_deref(),
52 instance.as_deref(),
53 subscription_id.as_deref(),
54 resource_group.as_deref(),
55 workspace.as_deref(),
56 location.as_deref(),
57 access_key_id.as_deref(),
58 secret_access_key.as_deref(),
59 region.as_deref(),
60 s3_bucket.as_deref(),
61 project_id.as_deref(),
62 processor_id.as_deref(),
63 service_account_key_path.as_deref(),
64 user_id.as_deref(),
65 qpu_id.as_deref(),
66 backend.as_deref(),
67 machine.as_deref(),
68 );
69 }
70 QpuAction::Show { provider } => {
71 qpu::run_show(&data_dir, provider.as_deref());
72 }
73 QpuAction::Clear { provider } => {
74 qpu::run_clear(&data_dir, provider);
75 }
76 QpuAction::TestConnection { provider } => {
77 qpu::run_test_connection(&data_dir, provider);
78 }
79 QpuAction::Submit {
80 provider,
81 problem_type,
82 qubits,
83 shots,
84 } => {
85 qpu::run_submit(&data_dir, provider, problem_type, *qubits, *shots);
86 }
87 }
88}