Esempio n. 1
0
    def handle(self, request, context):
        main_locations = []
        lib_locations = []

        for k in context.keys():
            if k.startswith('lib_'):
                lib_locations.append(context.get(k))

        if context.get("main_binary", None):
            main_locations.append(context["main_binary"])

        try:
            job = saharaclient.job_create(
                request,
                context["job_name"],
                context["job_type"],
                main_locations,
                lib_locations,
                context["job_description"])

            hlps = helpers.Helpers(request)
            if hlps.is_from_guide():
                request.session["guide_job_id"] = job.id
                request.session["guide_job_type"] = context["job_type"]
                request.session["guide_job_name"] = context["job_name"]
                self.success_url = (
                    "horizon:project:data_processing.wizard:jobex_guide")
            return True
        except Exception:
            exceptions.handle(request)
            return False
Esempio n. 2
0
    def handle(self, request, context):
        main_locations = []
        lib_locations = []

        for k in context.keys():
            if k.startswith('lib_'):
                lib_locations.append(context.get(k))

        if context.get("main_binary", None):
            main_locations.append(context["main_binary"])

        try:
            job = saharaclient.job_create(request, context["job_name"],
                                          context["job_type"], main_locations,
                                          lib_locations,
                                          context["job_description"])

            hlps = helpers.Helpers(request)
            if hlps.is_from_guide():
                request.session["guide_job_id"] = job.id
                request.session["guide_job_type"] = context["job_type"]
                request.session["guide_job_name"] = context["job_name"]
                self.success_url = (
                    "horizon:project:data_processing.wizard:jobex_guide")
            return True
        except Exception:
            exceptions.handle(request)
            return False
Esempio n. 3
0
    def handle(self, request, context):
        main_locations = []
        lib_locations = []

        for k in context.keys():
            if k.startswith('lib_'):
                lib_locations.append(context.get(k))

        if context.get("main_binary", None):
            main_locations.append(context["main_binary"])

        argument_ids = json.loads(context['argument_ids'])
        interface = [
            {
                "name": context['argument_name_' + str(arg_id)],
                "description": (context['argument_description_' + str(arg_id)]
                                or None),
                "mapping_type": context['argument_mapping_type_'
                                        + str(arg_id)],
                "location": context['argument_location_' + str(arg_id)],
                "value_type": context['argument_value_type_' + str(arg_id)],
                "required": context['argument_required_' + str(arg_id)],
                "default": (context['argument_default_value_' + str(arg_id)]
                            or None)
            } for arg_id in argument_ids
        ]

        try:
            job = saharaclient.job_create(
                request,
                context["job_name"],
                context["job_type"],
                main_locations,
                lib_locations,
                context["job_description"],
                interface=interface)

            hlps = helpers.Helpers(request)
            if hlps.is_from_guide():
                request.session["guide_job_id"] = job.id
                request.session["guide_job_type"] = context["job_type"]
                request.session["guide_job_name"] = context["job_name"]
                self.success_url = (
                    "horizon:project:data_processing.wizard:jobex_guide")
            return True
        except Exception:
            exceptions.handle(request)
            return False