-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: Add client for SystemLink jobs API #85
base: master
Are you sure you want to change the base?
feat: Add client for SystemLink jobs API #85
Conversation
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
assert len(response) == 1 | ||
|
||
def test__list_jobs__Invalid_system_id__fails(self, client: SystemClient): | ||
with pytest.raises(Exception): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with pytest.raises(Exception): | |
with pytest.raises(ApiException): |
reflect this in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified & reflected in other places.
Query("take"), | ||
], | ||
) | ||
def list_jobs( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def list_jobs( | |
def list_jobs_paged( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipping the suggestion as list jobs are not paged as it don't have continuation token property.
... | ||
|
||
@post("query-jobs") | ||
def query_jobs(self, query: models.QueryJobsRequest) -> models.QueryJobsResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def query_jobs(self, query: models.QueryJobsRequest) -> models.QueryJobsResponse: | |
def query_jobs_paged(self, query: models.QueryJobsRequest) -> models.QueryJobsResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipping the suggestion as query jobs are not paged as it don't have continuation token property.
The list of jobs that matched the criteria. | ||
|
||
Raises: | ||
ApiException: if unable to communicate with the System Service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ApiException: if unable to communicate with the System Service | |
ApiException: if unable to communicate with the ``/nisysmgmt`` Service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update in all other places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated it, & reflected the same in other places.
class CreateJobRequest(JobConfig): | ||
"""Model for create job request.""" | ||
|
||
metadata: Optional[Dict[str, Any]] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update it with actual properties..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated it. As CreateJobResponse
is extended from CreateJobRequest
, properties will be updated in it.
from nisystemlink.clients.core._uplink._json_model import JsonModel | ||
|
||
|
||
class HttpError(JsonModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ApiError
class from uplink core module instead of creating new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated it, & reflected the same in other places.
error: Optional[HttpError] = None | ||
"""Represents the standard error structure.""" | ||
|
||
data: Optional[List[str]] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the datatype of the data
property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the property.
@pytest.mark.integration | ||
@pytest.mark.enterprise | ||
class TestSystemClient: | ||
def test__create_job__succeeds( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we update test names with proper details?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the tests.
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
@@ -0,0 +1,10 @@ | |||
from ._job import Job, JobState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from ._job import Job, JobState | |
from ._job import Job, JobState, JobConfig, JobResult |
|
||
def test__list_jobs__invalid_system_id(self, client: SystemClient): | ||
response = client.list_jobs(system_id="Invalid_system_id") | ||
assert response == [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert response == [] | |
assert len(response) == 0 |
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
@ganesh-nithin , please update field/arg names to be Pythonic, for example |
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
Signed-off-by: Ganesh Nithin <sarvabhotla.g@solitontech.com>
What does this Pull Request accomplish?
This PR adds client methods for
job
group ofSystems
endpoints with integration tests for these endpointsWhy should this Pull Request be merged?
This System client (job) for System Management endpoints will improve user interactivity with those endpoints
What testing has been done?
Automated integration tests are included.
API Link: Swagger-link