Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add manager for jobs within a pipeline.#413

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

kw217
Copy link
Contributor

This PR adds a manager for jobs within a pipeline, so you can saygl.projects.get(prid).pipelines.get(plid).jobs.list() to list all of the jobs within a single pipeline (in GitLab v4).

Please let me know if there are any tests I should add. The existing UTs still pass.

Copy link
Contributor

@gpocentekgpocentek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for this change! Could you have a look at my comments and make the suggested modifications before I merge?

If could could add a couple examples (list and get) in the documentation that would be very nice.

Thanks again 👍

@@ -1940,6 +1942,12 @@ def create(self, data, **kwargs):
return CreateMixin.create(self, data, path=path, **kwargs)


class ProjectPipelineJobManager(RetrieveMixin, RESTManager):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could you useGetWithoutIdMixin instead ofRetrieveMixin?

It looks like getting a single job is not possible with the GitLab API, but we can simulate this feature by looping through the list.

@@ -1940,6 +1942,12 @@ def create(self, data, **kwargs):
return CreateMixin.create(self, data, path=path, **kwargs)


class ProjectPipelineJobManager(RetrieveMixin, RESTManager):
_path = '/projects/%(project_id)s/pipelines/%(pipeline_id)s/jobs'
_obj_cls = ProjectJob
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd rather use a newProjectPipelineJob instead ofProjectJob. This is choice I made for other objects and managers, so I'd rather stick to this logic.

Review markup: better to use a distinct ProjectPipelineJob ratherthan sharing ProjectJob. This is consistent with the other objectsand managers.
@kw217
Copy link
ContributorAuthor

Thanks@gpocentek - I've added some docs, distinguished the classes as you requested (I just made anpass subclass of the existing class - I hope that's what you wanted), and I've addedget support viaGetFromListMixin.

In principle we could implementget more efficiently by just callingProjectJobManager.get and checking the result is in the same pipeline, but there wasn't a mixin to do this already and I wasn't sure how to get hold of theProjectJobManager so I followed your suggestion instead.

Thanks.

@kw217
Copy link
ContributorAuthor

kw217 commentedJan 15, 2018
edited
Loading

Not sure why the Python 2.7 build failed, but it looks like a connection error pulling one of the libraries, not related to my change :-(

Edit: it seems to have passed now.

@gpocentekgpocentek merged commitbdb6d63 intopython-gitlab:masterJan 18, 2018
@gpocentek
Copy link
Contributor

@kw217 Thanks!

@kw217
Copy link
ContributorAuthor

Great, thank you!

@kw217kw217 deleted the add-pipeline-job-manager branchJanuary 18, 2018 11:18
@kw217
Copy link
ContributorAuthor

Hi@gpocentek - when are you likely to spin a new release containing this enhancement? I'd like to use it in a tool I'm writing, and it will be simpler to point people at PyPI than getting them to download master. Thanks.

@gpocentek
Copy link
Contributor

Hi@kw217

I'd like to fix a few bugs and merge#398 before doing a release. I hope I'll have this ready in a couple weeks.

@kw217
Copy link
ContributorAuthor

Super - that would be great. Thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gpocentekgpocentekgpocentek approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@kw217@gpocentek

[8]ページ先頭

©2009-2025 Movatter.jp