wy_qcos_client package

Subpackages

Submodules

wy_qcos_client.client module

class wy_qcos_client.client.SSL

基类:object

SSL configs.

use_ssl = False
cert_file = None
key_file = None
ca_file = None
class wy_qcos_client.client.Client(api_server_ip=Constant.DEFAULT_API_SERVER_LISTEN_IP, api_server_port=Constant.DEFAULT_API_SERVER_LISTEN_PORT, use_ssl=False, ssl_certfile=None, ssl_keyfile=None, ssl_cafile=None, timeout=30)

基类:object

QCOS client api.

verbose = False
timeout = 30
static print_api_response(status_code, reason, text, result=None)

Print API response.

参数:
  • status_code -- status code

  • reason -- reason

  • text -- text

  • result -- result text (Default value = None)

static call_json_rpc(url, method_name, data=None, params=None)

Call json-rpc.

参数:
  • url -- json-rpc url

  • method_name -- json-rpc method

  • data -- json-rpc data (Default value = None)

  • params -- json-rpc params (Default value = None)

static parse_jsonrpc_response(jsonrpc_response)

Parse json-rpc response.

参数:

jsonrpc_response -- json-rpc response

static handle_invalid_arguments(results)

Handle invalid arguments.

参数:

results -- results

version()

Get all api versions and capabilities.

返回:

Version

get_drivers()

Get driver list.

返回:

Driver list message

get_driver(driver_name)

Get driver info.

参数:

driver_name -- driver name

返回:

driver info

get_devices()

Get device list.

返回:

Device list message

get_device(device_name, details=False)

Get device info.

参数:
  • device_name -- device name

  • details -- need details information or not

返回:

device info

calibrate(device_name, options=None)

Get device info.

参数:
  • device_name -- device name

  • options -- calibration options

enable_and_disable_qubit(device_name, qubits)

Enable and Disalbe Qubit.

参数:
  • device_name -- device name

  • qubits -- qubits

set_device_options(device_name, device_options)

Set device options.

参数:
  • device_name -- device name

  • device_options -- device options

get_transpilers()

Get transpiler list.

返回:

Transpiler list message

get_transpiler(transpiler_name)

Get transpiler info.

参数:

transpiler_name -- transpiler name

返回:

transpiler info

ping(message)

Ping-pong to verify the availability of the system.

参数:

message -- Ping message

返回:

Pong message

system_info()

Get system info.

返回:

System info

submit_job(source_code, *, circuit_aggregation=None, code_type=Constant.CODE_TYPE_QASM, job_id=None, job_name=None, job_type=Constant.JOB_TYPE_SAMPLING, job_priority=Constant.DEFAULT_JOB_PRIORITY, description=None, shots=Constant.DEFAULT_SHOTS, backend=Constant.DRIVER_DUMMY, driver_options=None, transpiler=Constant.TRANSPILER_CMSS, transpiler_options=None, profiling=None, callbacks=None, dry_run=False)

Submit new job.

参数:
  • source_code -- source code

  • code_type -- code type

  • circuit_aggregation -- circuit aggregation

  • job_id -- job uuid

  • job_name -- job name

  • job_type -- job type

  • job_priority -- job priority. Values: 1-10, Default: 5. Highest priority: 1, Lowest Priority: 10

  • description -- job description

  • shots -- shots

  • backend -- backend name

  • driver_options -- driver options

  • transpiler -- transpiler name

  • transpiler_options -- transpiler options

  • profiling -- profiling types

  • callbacks -- callbacks

  • dry_run -- dry run

返回:

submit_job result

get_job_status(job_id)

Get job status.

参数:

job_id -- job ID

返回:

job status

get_job_results(job_id)

Get job results.

参数:

job_id -- job ID

返回:

job results

get_jobs()

Get job status.

返回:

job status

cancel_jobs(job_ids)

Cancel jobs.

参数:

job_ids -- job IDs

返回:

jobs

delete_jobs(job_ids)

Delete jobs.

参数:

job_ids -- job IDs

返回:

jobs

set_job_results(job_id, new_results)

Set job results.

参数:
  • job_id -- job ID

  • new_results -- new results list to set

返回:

jobs

update_job(job_id=None, job_priority=Constant.DEFAULT_JOB_PRIORITY)

Update job.

参数:
  • job_id -- job uuid

  • job_priority -- job priority. Values: 1-10, Default: 5. Highest priority: 1, Lowest Priority: 10

返回:

update_job result

wy_qcos_client.shell module

class wy_qcos_client.shell.QcosShell(description, version, command_manager)

基类:App

QCOS shell.

CMD_GROUP_DEFAULT = 'Default'
CMD_GROUP_DRIVER = 'Driver'
CMD_GROUP_DEVICE = 'Device'
CMD_GROUP_TRANSPILER = 'Transpiler'
CMD_GROUP_JOB = 'Job'
CMD_GROUP_SYSTEM = 'System'
CMD_GROUP_VERSION = 'Version'
CMD_GROUPS = ['Default', 'Version', 'Driver', 'Device', 'Transpiler', 'System', 'Job']
clean_up(cmd, result, err)

Clean up after command execution.

initialize_app(argv)

Hook for subclasses to take global initialization action after the arguments are parsed but before a command is run. Invoked only once, even in interactive mode.

参数:

argv -- List of arguments, including the subcommand to run. Empty for interactive mode.

build_option_parser(description, version, argparse_kwargs=None)

Return an argparse option parser for this application.

Subclasses may override this method to extend the parser with more global options.

参数:
  • description -- full description of the application

  • version -- version number for the application

  • argparse_kwargs -- argparse keyword arguments (Default value = None)

class wy_qcos_client.shell.HelpAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)

基类:Action

Print help message including sub-commands.

Provide a custom action so the -h and --help options to the main app will print a list of the commands.

The commands are determined by checking the CommandManager instance, passed in as the "default" value for the action.

class wy_qcos_client.shell.CommandHelper

基类:object

Command helper.

static handle_invalid_arguments(results)

Handle invalid arguments.

参数:

results -- results

static check_results(resource, name, status_code, reason, jsonrpc_response)

Check results.

参数:
  • resource -- resource

  • name -- name

  • status_code -- status code

  • reason -- reason

  • jsonrpc_response -- json-rpc response

static get_table_list_data(list_dict_values, header_list, is_dict=False, ignore_header_list=None)

Get list of data for showing table in cli.

参数:
  • list_dict_values -- list or dict of values

  • header_list -- headers for table

  • is_dict -- whether is dict or list values (Default value = False)

  • ignore_header_list -- headers to ignore (Default value = None)

返回:

list of table data

static get_table_data(values)

Get data for showing table in cli.

参数:

values -- values

返回:

table data

class wy_qcos_client.shell.Version(app, app_args, cmd_name=None)

基类:Command

Get server version.

参数:
  • app (_app.App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Version'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.GetDrivers(app, app_args, cmd_name=None)

基类:Lister

Get driver list.

参数:
  • app (App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Driver'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.GetDriver(app, app_args, cmd_name=None)

基类:ShowOne

Get driver info.

参数:
  • app (App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Driver'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.GetDevices(app, app_args, cmd_name=None)

基类:Lister

Get device list.

参数:
  • app (App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Device'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.GetDevice(app, app_args, cmd_name=None)

基类:ShowOne

Get device info.

参数:
  • app (App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Device'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.GetTranspilers(app, app_args, cmd_name=None)

基类:Lister

Get transpiler list.

参数:
  • app (App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Transpiler'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.GetTranspiler(app, app_args, cmd_name=None)

基类:ShowOne

Get transpiler info.

参数:
  • app (App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Transpiler'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.Ping(app, app_args, cmd_name=None)

基类:Command

Ping-pong to verify the availability of the system.

参数:
  • app (_app.App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'System'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.SystemInfo(app, app_args, cmd_name=None)

基类:ShowOne

Show system information.

参数:
  • app (App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'System'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.SubmitJob(app, app_args, cmd_name=None)

基类:Command

Submit job.

参数:
  • app (_app.App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Job'
static validate_filepath(file_path)
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.GetJobStatus(app, app_args, cmd_name=None)

基类:ShowOne

Get job status.

参数:
  • app (App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Job'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

返回:

results of command

class wy_qcos_client.shell.GetJobResults(app, app_args, cmd_name=None)

基类:ShowOne

Get job results.

参数:
  • app (App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Job'
validate_file(outfile)

Validate file.

参数:

outfile (str) -- output file name

返回:

output file name

save_file(outfile, job_results)

Save job_results to file.

参数:
  • outfile (str) -- output file name

  • job_results -- job results

get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

返回:

results of command

class wy_qcos_client.shell.GetJobs(app, app_args, cmd_name=None)

基类:Lister

Get jobs.

参数:
  • app (App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Job'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.CancelJobs(app, app_args, cmd_name=None)

基类:Command

Cancel jobs.

参数:
  • app (_app.App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Job'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.DeleteJobs(app, app_args, cmd_name=None)

基类:Command

Delete jobs.

参数:
  • app (_app.App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Job'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.UpdateJob(app, app_args, cmd_name=None)

基类:Command

Update job.

参数:
  • app (_app.App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Job'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

class wy_qcos_client.shell.SetJobResults(app, app_args, cmd_name=None)

基类:Command

Set job results.

参数:
  • app (_app.App)

  • app_args (Namespace | None)

  • cmd_name (str | None)

group = 'Job'
get_parser(prog_name)

Get parser for this command.

参数:

prog_name -- program name

返回:

parser

take_action(parsed_args)

Take action for command line arguments.

参数:

parsed_args -- command line arguments

wy_qcos_client.shell.set_debug_option(args)

Set debug option.

wy_qcos_client.shell.get_content_by_type(code_type, file_path)

Get file content by file type.

参数:
  • code_type -- code type

  • file_path -- file path

返回:

file content

wy_qcos_client.shell.main()

Main function.

Module contents