Skip to content

Instantly share code, notes, and snippets.



Created Aug 29, 2017
What would you like to do?
class BaseJobResource(Resource):
def dispatch_request(
self, provider: str, owner_name: str, repo_name: str, build_number: int, job_number: int, *args, **kwargs
) -> Response:
queryset = Job.query.join(Build, == Job.build_id).join(
Repository, == Build.repository_id
Repository.provider == RepositoryProvider(provider),
Repository.owner_name == owner_name, == repo_name,
Build.number == build_number,
Job.number == job_number,
if self.is_mutation():
queryset = queryset.with_for_update()
job = queryset.first()
if not job:
return self.not_found()
return Resource.dispatch_request(self, job, *args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.