-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Azure Quantum client for Azure SDK for Java #18734
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
Merged
Merged
Changes from 41 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
7943db2
Add .gitignore
vxfield 0d0c2fb
add autogenerated code
fdce73c
add pom file; regenerate code with fluent:false
6b88dec
change naming; add preliminary tests
3c29b78
Add auth layer; working list test
04b9554
Add auth layer; working list test (#18796)
anjbur 0a333c9
add dependency scope
3d7b32a
Merge branch 'feature/azure-quantum-sdk' of github.com:Azure/azure-sd…
13572b9
cleanup
2ddf645
add ci.yml; update pom.xml
5428b34
move and update ci.yml
f164859
move pom.xml to root
63a015f
update pom.xml and ci.yml
6ed50c0
regenerate code with authentication
ee87036
add credentials code
1fcc15d
add module-info.java
7dedc8e
add second pom.xml
1504474
add parent to pom.xml
23fc441
add quantum module to root pom.xml
f9d7530
update root pom.xml
02b77fa
update project pom
616c13c
remove comment at start
649f771
update versions, add maven-enforcer-plugin
3a3696a
fix versioning
47887b3
add README, CHANGELOG
777ce4e
add tests.yml
d3204fb
fix readme
2aa059a
fix changelong
3909fc4
update changelog
e156c52
Update CHANGELOG.md
vxfield 138009b
update version, skip test coverage
6e3c632
Merge branch 'feature/azure-quantum-sdk' of github.com:Azure/azure-sd…
19fb0ff
add runtime/compile scopes to pom.xml
c793d3e
prune pom.xml
9d8cdd8
add back dependency
08216c4
suppress alerts on generated code
c0d5df7
only suppress generated code
76f0506
add playback tests
8967268
fix header on tests
04da2b7
PR comment fixes
b455895
PR comment fixes
2d13b53
fix pom.xml
74d72a5
PR comments
9970901
resolve PR comment
1638e0b
fix version file
e646d16
fix tests.yml
ccaef0e
fix groupId in ci.yml
95649a8
change from no test coverage to minimal coverage required
8fad6c0
resolve PR comments
333827f
remove unused imports
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Release History | ||
|
|
||
| ## 1.0.0-beta.1 (Unreleased) | ||
|
|
||
| ### New features | ||
| - Initial preview of Azure.Quantum.Jobs | ||
|
anjbur marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # Azure Quantum Jobs client library for Java | ||
|
|
||
| Use the guidelines in each section of this template to ensure consistency and readability of your README. The README resides in your package's GitHub repository at the root of its directory within the repo. It's also used as the package distribution page (NuGet, PyPi, npm, etc.) and as a Quickstart on docs.microsoft.com. | ||
|
anjbur marked this conversation as resolved.
Outdated
|
||
|
|
||
| **Title**: The H1 of your README should be in the format: `# [Product Name] client library for [Language]` | ||
|
|
||
| * All headings, including the H1, should use **sentence-style capitalization**. Refer to the [Microsoft Style Guide][style-guide-msft]. | ||
| * Example: `# Azure Batch client library for Python` | ||
|
anjbur marked this conversation as resolved.
Outdated
|
||
|
|
||
| **Introduction**: The introduction appears directly under the title (H1) of your README. | ||
|
|
||
| * **DO NOT** use an "Introduction" or "Overview" heading (H2) for this section. | ||
| * First sentence: **Describe the service** briefly. You can usually use the first line of the service's docs landing page for this (Example: [Cosmos DB docs landing page](https://docs.microsoft.com/azure/cosmos-db/)). | ||
| * Next, add a **bulleted list** of the **most common tasks** supported by the package or library, prefaced with "Use the client library for [Product Name] to:". Then, provide code snippets for these tasks in the [Examples](#examples) section later in the document. Keep the task list short but include those tasks most developers need to perform with your package. | ||
|
|
||
| > TIP: Your README should be as **brief** as possible but **no more brief** than necessary to get a developer new to Azure, the service, or the package up and running quickly. Keep it brief, but include everything a developer needs to make their first API call successfully. | ||
|
|
||
| ## Getting started | ||
|
|
||
| This section should include everything a developer needs to do to install and create their first client connection *very quickly*. | ||
|
|
||
| ### Install the package | ||
|
|
||
| First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `pip install package-name`, but should enable a developer to successfully install the package from NuGet, pip, npm, Maven, or even cloning a GitHub repository. | ||
|
|
||
| Include a **Prerequisites** line after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: | ||
|
|
||
| **Prerequisites**: You must have an [Azure subscription](https://azure.microsoft.com/free/), [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API), and [Python 3.6+](https://www.python.org/downloads/) to use this package. | ||
|
|
||
| ### Authenticate the client | ||
|
|
||
| If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. | ||
|
|
||
| For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. | ||
|
|
||
| ## Key concepts | ||
|
|
||
| The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. | ||
|
|
||
| ## Examples | ||
|
|
||
| Include code snippets and short descriptions for each task you listed in the [Introduction](#introduction) (the bulleted list). Briefly explain each operation, but include enough clarity to explain complex or otherwise tricky operations. | ||
|
|
||
| If possible, use the same example snippets that your in-code documentation uses. For example, use the snippets in your `examples.py` that Sphinx ingests via its [literalinclude](https://www.sphinx-doc.org/en/1.5/markup/code.html?highlight=code%20examples#includes) directive. The `examples.py` file containing the snippets should reside alongside your package's code, and should be tested in an automated fashion. | ||
|
|
||
| Each example in the *Examples* section starts with an H3 that describes the example. At the top of this section, just under the *Examples* H2, add a bulleted list linking to each example H3. Each example should deep-link to the types and/or members used in the example. | ||
|
|
||
| * [Create the thing](#create-the-thing) | ||
| * [Get the thing](#get-the-thing) | ||
| * [List the things](#list-the-things) | ||
|
|
||
| ### Create the thing | ||
|
|
||
| Use the `create_thing` method to create a Thing reference; this method does not make a network call. To persist the Thing in the service, call `Thing.save`. | ||
|
|
||
| ```Python | ||
| thing = client.create_thing(id, name) | ||
| thing.save() | ||
| ``` | ||
|
anjbur marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### Get the thing | ||
|
|
||
| The `get_thing` method retrieves a Thing from the service. The `id` parameter is the unique ID of the Thing, not its "name" property. | ||
|
|
||
| ```Python | ||
| thing = client.get_thing(id) | ||
| ``` | ||
|
|
||
| ### List the things | ||
|
|
||
| Use `list_things` to get one or more Thing objects from the service. If there are no Things available, a `404` exception is thrown (see [Troubleshooting](#troubleshooting) for details on handling exceptions). | ||
|
|
||
| ```Python | ||
| things = client.list_things() | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. | ||
|
|
||
| Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. | ||
|
|
||
| If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. | ||
|
|
||
| ## Next steps | ||
|
|
||
| * Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. | ||
| * If appropriate, point users to other packages that might be useful. | ||
| * If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. | ||
|
|
||
| ## Contributing | ||
|
|
||
| This is a template, but your SDK readme should include details on how to contribute code to the repo/package. | ||
|
|
||
| <!-- LINKS --> | ||
| [style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization | ||
|
|
||
|  | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-client-sdk-parent</artifactId> | ||
| <version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} --> | ||
| <relativePath>../../parents/azure-client-sdk-parent</relativePath> | ||
| </parent> | ||
|
|
||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-quantum-jobs</artifactId> | ||
| <version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-quantum-jobs;current} --> | ||
|
|
||
| <name>Microsoft Azure client library for Azure Quantum service</name> | ||
| <description>This package contains the Microsoft Azure Quantum SDK.</description> | ||
| <url>https://github.com/Azure/azure-sdk-for-java</url> | ||
|
|
||
| <distributionManagement> | ||
| <site> | ||
| <id>azure-java-build-docs</id> | ||
| <url>${site.url}/site/${project.artifactId}</url> | ||
| </site> | ||
| </distributionManagement> | ||
|
|
||
| <scm> | ||
| <url>scm:git:https://github.com/Azure/azure-sdk-for-java</url> | ||
| <connection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</connection> | ||
| <tag>HEAD</tag> | ||
| </scm> | ||
|
|
||
| <properties> | ||
| <!-- quantum jobs temporarily skipping code coverage until tests are added --> | ||
| <jacoco.skip.coverage.check>true</jacoco.skip.coverage.check> | ||
|
anjbur marked this conversation as resolved.
Outdated
|
||
| </properties> | ||
|
|
||
| <dependencies> | ||
|
|
||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-core</artifactId> | ||
|
anjbur marked this conversation as resolved.
|
||
| <version>1.12.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} --> | ||
| </dependency> | ||
|
|
||
|
|
||
|
|
||
| <!-- Test Dependencies --> | ||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-params</artifactId> | ||
| <version>5.6.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-params;external_dependency} --> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-core-test</artifactId> | ||
| <version>1.5.2</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} --> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-identity</artifactId> | ||
| <version>1.2.2</version> <!-- {x-version-update;com.azure:azure-identity;dependency} --> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| </dependencies> | ||
|
|
||
| </project> | ||
158 changes: 158 additions & 0 deletions
158
sdk/quantum/azure-quantum-jobs/src/main/java/com/azure/quantum/jobs/JobsAsyncClient.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for | ||
| // license information. | ||
| // | ||
| // Code generated by Microsoft (R) AutoRest Code Generator. | ||
|
|
||
| package com.azure.quantum.jobs; | ||
|
|
||
| import com.azure.core.annotation.ReturnType; | ||
| import com.azure.core.annotation.ServiceClient; | ||
| import com.azure.core.annotation.ServiceMethod; | ||
| import com.azure.core.exception.HttpResponseException; | ||
| import com.azure.core.http.rest.PagedFlux; | ||
| import com.azure.core.http.rest.PagedResponse; | ||
| import com.azure.core.http.rest.Response; | ||
| import com.azure.quantum.jobs.implementation.JobsImpl; | ||
| import com.azure.quantum.jobs.models.JobDetails; | ||
| import com.azure.quantum.jobs.models.RestErrorException; | ||
| import reactor.core.publisher.Mono; | ||
|
|
||
| /** Initializes a new instance of the asynchronous QuantumClient type. */ | ||
| @ServiceClient(builder = QuantumClientBuilder.class, isAsync = true) | ||
| public final class JobsAsyncClient { | ||
| private final JobsImpl serviceClient; | ||
|
|
||
| /** | ||
| * Initializes an instance of Jobs client. | ||
| * | ||
| * @param serviceClient the service client implementation. | ||
| */ | ||
| JobsAsyncClient(JobsImpl serviceClient) { | ||
| this.serviceClient = serviceClient; | ||
| } | ||
|
|
||
| /** | ||
| * List jobs. | ||
| * | ||
| * @throws HttpResponseException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return list of job details. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.COLLECTION) | ||
| public Mono<PagedResponse<JobDetails>> listSinglePage() { | ||
| return this.serviceClient.listSinglePageAsync(); | ||
| } | ||
|
|
||
| /** | ||
| * List jobs. | ||
| * | ||
| * @throws HttpResponseException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return list of job details. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.COLLECTION) | ||
| public PagedFlux<JobDetails> list() { | ||
| return this.serviceClient.listAsync(); | ||
| } | ||
|
|
||
| /** | ||
| * Get job by id. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return job by id. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<Response<JobDetails>> getWithResponse(String jobId) { | ||
| return this.serviceClient.getWithResponseAsync(jobId); | ||
| } | ||
|
|
||
| /** | ||
| * Get job by id. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return job by id. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<JobDetails> get(String jobId) { | ||
| return this.serviceClient.getAsync(jobId); | ||
| } | ||
|
|
||
| /** | ||
| * Create a job. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @param job The complete metadata of the job to submit. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return job details. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<Response<JobDetails>> createWithResponse(String jobId, JobDetails job) { | ||
| return this.serviceClient.createWithResponseAsync(jobId, job); | ||
| } | ||
|
|
||
| /** | ||
| * Create a job. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @param job The complete metadata of the job to submit. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return job details. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<JobDetails> create(String jobId, JobDetails job) { | ||
| return this.serviceClient.createAsync(jobId, job); | ||
| } | ||
|
|
||
| /** | ||
| * Cancel a job. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return the completion. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<Response<Void>> cancelWithResponse(String jobId) { | ||
| return this.serviceClient.cancelWithResponseAsync(jobId); | ||
| } | ||
|
|
||
| /** | ||
| * Cancel a job. | ||
| * | ||
| * @param jobId Id of the job. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws RestErrorException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return the completion. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Mono<Void> cancel(String jobId) { | ||
| return this.serviceClient.cancelAsync(jobId); | ||
| } | ||
|
|
||
| /** | ||
| * Get the next page of items. | ||
| * | ||
| * @param nextLink The nextLink parameter. | ||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||
| * @throws HttpResponseException thrown if the request is rejected by server. | ||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
| * @return list of job details. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.COLLECTION) | ||
| public Mono<PagedResponse<JobDetails>> listNextSinglePage(String nextLink) { | ||
| return this.serviceClient.listNextSinglePageAsync(nextLink); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.