Exemplo n.º 1
0
    def test_verify_work_request_no_executable(self):
        """
        rapid-unit: Rapid Client:Remote Execution:Can remotely execute code on client
        :return:
        :rtype:
        """
        work_request = WorkRequest()
        executor = Executor(work_request, "http")
        work_request.action_instance_id = 1

        with self.assertRaises(Exception) as cm:
            executor.verify_work_request()
        self.assertEqual("Executable not set, nothing to run.", str(cm.exception))
Exemplo n.º 2
0
    def test_verify_work_request_no_pipeline_instance_id(self):
        """
        rapid-unit: Rapid Client:Remote Execution:Can remotely execute code on client
        :return:
        :rtype:
        """
        work_request = WorkRequest()
        executor = Executor(work_request, "http")
        work_request.action_instance_id = 1
        work_request.executable = "something"

        with self.assertRaises(Exception) as cm:
            executor.verify_work_request()
        self.assertEqual("No pipline_instance_id set.", str(cm.exception))
Exemplo n.º 3
0
    def configure_work_request(self,
                               action_instance,
                               pipeline_parameters,
                               work_requests,
                               results,
                               include_configuration=True):
        """
        :param action_instance:
        :type action_instance: ActionInstance
        :param pipeline_parameters:
        :type pipeline_parameters: PipelineParameters
        :param results:
        :type results: list
        :return:
        :rtype:
        """
        work_request = None
        if action_instance.id not in work_requests:
            work_request = WorkRequest(action_instance.serialize())
            work_request.action_instance_id = action_instance.id
            work_request.pipeline_instance_id = action_instance.pipeline_instance_id
            work_request.workflow_instance_id = action_instance.workflow_instance_id
            work_request.slice = action_instance.slice
            results.append(work_request)
            work_requests[action_instance.id] = work_request
        else:
            work_request = work_requests[action_instance.id]

        if pipeline_parameters:
            work_request.environment[
                pipeline_parameters.parameter] = pipeline_parameters.value

        if include_configuration:
            try:
                work_request.configuration = action_instance.configuration.configuration
            except (TypeError, AttributeError):
                pass