feat: Add client for SystemLink jobs API#85
feat: Add client for SystemLink jobs API#85ganesh-nithin wants to merge 23 commits intoni:masterfrom
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.
| with pytest.raises(Exception): | |
| with pytest.raises(ApiException): |
reflect this in other places.
There was a problem hiding this comment.
Modified & reflected in other places.
| Query("take"), | ||
| ], | ||
| ) | ||
| def list_jobs( |
There was a problem hiding this comment.
| def list_jobs( | |
| def list_jobs_paged( |
There was a problem hiding this comment.
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.
| 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.
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.
| 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.
Update in all other places
There was a problem hiding this comment.
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.
Please update it with actual properties..
There was a problem hiding this comment.
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.
Use ApiError class from uplink core module instead of creating new one.
There was a problem hiding this comment.
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.
Please change the datatype of the data property.
| @pytest.mark.integration | ||
| @pytest.mark.enterprise | ||
| class TestSystemClient: | ||
| def test__create_job__succeeds( |
There was a problem hiding this comment.
can we update test names with proper details?
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.
| 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.
| 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
jobgroup ofSystemsendpoints 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