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