def trigger_runnable_jobs(self, request, project, jm, pk=None):
        """
        Add new jobs to a resultset.
        """
        if not pk:
            return Response({"message": "resultset id required"},
                            status=HTTP_400_BAD_REQUEST)

        # Making sure a resultset with this id exists
        filter = UrlQueryFilter({"id": pk})
        full = filter.pop('full', 'true').lower() == 'true'
        result_set_list = jm.get_result_set_list(0, 1, full, filter.conditions)
        if not result_set_list:
            return Response(
                {"message": "No resultset with id: {0}".format(pk)},
                status=HTTP_404_NOT_FOUND)

        requested_jobs = request.data.get('requested_jobs', [])
        decision_task_id = request.data.get('decision_task_id', [])
        if not requested_jobs:
            Response({"message": "The list of requested_jobs cannot be empty"},
                     status=HTTP_400_BAD_REQUEST)

        publish_resultset_runnable_job_action.apply_async(
            args=[
                project, pk, request.user.email, requested_jobs,
                decision_task_id
            ],
            routing_key='publish_to_pulse')

        return Response(
            {"message": "New jobs added for push '{0}'".format(pk)})
Exemple #2
0
    def trigger_runnable_jobs(self, request, project, jm, pk=None):
        """
        Add new jobs to a resultset.
        """
        if not pk:
            return Response({"message": "result set id required"},
                            status=HTTP_400_BAD_REQUEST)

        # Making sure a push with this id exists
        if not Push.objects.filter(id=pk).exists():
            return Response({"message": "No result set with id: {0}".format(pk)},
                            status=HTTP_404_NOT_FOUND)

        requested_jobs = request.data.get('requested_jobs', [])
        decision_task_id = request.data.get('decision_task_id', [])
        if not requested_jobs:
            Response({"message": "The list of requested_jobs cannot be empty"},
                     status=HTTP_400_BAD_REQUEST)

        publish_resultset_runnable_job_action.apply_async(
            args=[project, pk, request.user.email, requested_jobs, decision_task_id],
            routing_key='publish_to_pulse'
        )

        return Response({"message": "New jobs added for push '{0}'".format(pk)})
Exemple #3
0
    def trigger_runnable_jobs(self, request, project, pk=None):
        """
        Add new jobs to a resultset.
        """
        if not pk:
            return Response({"message": "result set id required"},
                            status=HTTP_400_BAD_REQUEST)

        # Making sure a push with this id exists
        if not Push.objects.filter(id=pk).exists():
            return Response(
                {"message": "No result set with id: {0}".format(pk)},
                status=HTTP_404_NOT_FOUND)

        requested_jobs = request.data.get('requested_jobs', [])
        decision_task_id = request.data.get('decision_task_id', [])
        if not requested_jobs:
            Response({"message": "The list of requested_jobs cannot be empty"},
                     status=HTTP_400_BAD_REQUEST)

        publish_resultset_runnable_job_action.apply_async(
            args=[
                project, pk, request.user.email, requested_jobs,
                decision_task_id
            ],
            routing_key='publish_to_pulse')

        return Response(
            {"message": "New jobs added for push '{0}'".format(pk)})
Exemple #4
0
    def trigger_runnable_jobs(self, request, project, jm, pk=None):
        """
        Add new jobs to a resultset.
        """
        if not pk:
            return Response({"message": "resultset id required"}, status=HTTP_400_BAD_REQUEST)

        # Making sure a resultset with this id exists
        filter = UrlQueryFilter({"id": pk})
        full = filter.pop('full', 'true').lower() == 'true'
        result_set_list = jm.get_result_set_list(0, 1, full, filter.conditions)
        if not result_set_list:
            return Response({"message": "No resultset with id: {0}".format(pk)},
                            status=HTTP_404_NOT_FOUND)

        requested_jobs = request.data.get('requested_jobs', [])
        decisionTaskID = request.data.get('decisionTaskID', [])
        if len(requested_jobs) == 0:
            Response({"message": "The list of requested_jobs cannot be empty"},
                     status=HTTP_400_BAD_REQUEST)

        publish_resultset_runnable_job_action.apply_async(
            args=[project, pk, request.user.email, requested_jobs, decisionTaskID],
            routing_key='publish_to_pulse'
        )

        return Response({"message": "New jobs added for push '{0}'".format(pk)})
Exemple #5
0
    def trigger_runnable_jobs(self, request, project, jm, pk=None):
        """
        Add new jobs to a resultset.
        """
        if not pk:
            return Response({"message": "resultset id required"}, status=400)

        # Making sure a resultset with this id exists
        filter = UrlQueryFilter({"id": pk})
        full = filter.pop('full', 'true').lower() == 'true'
        result_set_list = jm.get_result_set_list(0, 1, full, filter.conditions)
        if not result_set_list:
            return Response(
                {"message": "No resultset with id: {0}".format(pk)},
                status=404)

        buildernames = request.data.get('buildernames', [])
        if len(buildernames) == 0:
            Response({"message": "The list of buildernames cannot be empty"},
                     status=400)

        publish_resultset_runnable_job_action.apply_async(
            args=[project, pk, request.user.email, buildernames],
            routing_key='publish_to_pulse')

        return Response(
            {"message": "New jobs added for push '{0}'".format(pk)})