def cancel_all(self, request, project, pk=None): """ Cancel all pending and running jobs in this resultset """ if not pk: # pragma nocover return Response({"message": "resultset id required"}, status=HTTP_400_BAD_REQUEST) # Sending 'cancel_all' action to pulse. Right now there is no listener # for this, so we cannot remove 'cancel' action for each job below. publish_resultset_action.apply_async( args=[project, 'cancel_all', pk, request.user.email], routing_key='publish_to_pulse') # Notify the build systems which created these jobs... for job in Job.objects.filter(push_id=pk).exclude(state='completed'): publish_job_action.apply_async( args=[project, 'cancel', job.id, request.user.email], routing_key='publish_to_pulse') # Mark pending jobs as cancelled to work around buildbot not including # cancelled jobs in builds-4hr if they never started running. # TODO: Remove when we stop using buildbot. Job.objects.filter(push_id=pk, state='pending').update( state='completed', result='usercancel', last_modified=datetime.datetime.now()) return Response({ "message": "pending and running jobs canceled for resultset '{0}'".format(pk) })
def cancel_all(self, request, project, pk=None): """ Cancel all pending and running jobs in this resultset """ if not pk: # pragma nocover return Response({"message": "resultset id required"}, status=HTTP_400_BAD_REQUEST) # Sending 'cancel_all' action to pulse. Right now there is no listener # for this, so we cannot remove 'cancel' action for each job below. publish_resultset_action.apply_async( args=[project, 'cancel_all', pk, request.user.email], routing_key='publish_to_pulse' ) # Notify the build systems which created these jobs... for job in Job.objects.filter(push_id=pk).exclude(state='completed'): publish_job_action.apply_async( args=[project, 'cancel', job.id, request.user.email], routing_key='publish_to_pulse' ) # Mark pending jobs as cancelled to work around buildbot not including # cancelled jobs in builds-4hr if they never started running. # TODO: Remove when we stop using buildbot. Job.objects.filter(push_id=pk, state='pending').update( state='completed', result='usercancel', last_modified=datetime.datetime.now()) return Response({"message": "pending and running jobs canceled for resultset '{0}'".format(pk)})
def trigger_missing_jobs(self, request, project, pk=None): """ Trigger jobs that are missing in a resultset. """ if not pk: return Response({"message": "resultset id required"}, status=HTTP_400_BAD_REQUEST) publish_resultset_action.apply_async( args=[project, "trigger_missing_jobs", pk, request.user.email], routing_key='publish_to_pulse' ) return Response({"message": "Missing jobs triggered for result set '{0}'".format(pk)})
def trigger_missing_jobs(self, request, project, pk=None): """ Trigger jobs that are missing in a resultset. """ if not pk: return Response({"message": "resultset id required"}, status=HTTP_400_BAD_REQUEST) publish_resultset_action.apply_async( args=[project, "trigger_missing_jobs", pk, request.user.email], routing_key='publish_to_pulse') return Response({ "message": "Missing jobs triggered for result set '{0}'".format(pk) })
def trigger_all_talos_jobs(self, request, project, pk=None): """ Trigger all the talos jobs in a resultset. """ if not pk: return Response({"message": "resultset id required"}, status=HTTP_400_BAD_REQUEST) times = int(request.query_params.get('times', None)) if not times: raise ParseError(detail="The 'times' parameter is mandatory for this endpoint") publish_resultset_action.apply_async( args=[project, "trigger_all_talos_jobs", pk, request.user.email, times], routing_key='publish_to_pulse' ) return Response({"message": "Talos jobs triggered for result set '{0}'".format(pk)})
def trigger_all_talos_jobs(self, request, project, pk=None): """ Trigger all the talos jobs in a resultset. """ if not pk: return Response({"message": "resultset id required"}, status=HTTP_400_BAD_REQUEST) times = int(request.query_params.get('times', None)) if not times: raise ParseError( detail="The 'times' parameter is mandatory for this endpoint") publish_resultset_action.apply_async(args=[ project, "trigger_all_talos_jobs", pk, request.user.email, times ], routing_key='publish_to_pulse') return Response({ "message": "Talos jobs triggered for result set '{0}'".format(pk) })
def cancel_all_jobs_for_push(self, requester, push_id): """Set all pending/running jobs in resultset to usercancel.""" jobs = self.get_incomplete_job_ids(push_id) # Mark pending jobs as cancelled to work around buildbot not including # cancelled jobs in builds-4hr if they never started running. # TODO: Remove when we stop using buildbot. self.execute( proc='jobs.updates.cancel_all', placeholders=[push_id], debug_show=self.DEBUG ) # Sending 'cancel_all' action to pulse. Right now there is no listener # for this, so we cannot remove 'cancel' action for each job below. publish_resultset_action.apply_async( args=[self.project, 'cancel_all', push_id, requester], routing_key='publish_to_pulse' ) # Notify the build systems which created these jobs... for job in jobs: self._job_action_event(job, 'cancel', requester)
def trigger_all_talos_jobs(self, requester, push_id, times): publish_resultset_action.apply_async( args=[self.project, "trigger_all_talos_jobs", push_id, requester, times], routing_key='publish_to_pulse' )
def trigger_missing_jobs(self, requester, push_id): publish_resultset_action.apply_async( args=[self.project, "trigger_missing_jobs", push_id, requester], routing_key='publish_to_pulse' )