Ejemplo n.º 1
0
 def get_context_data(self, request):
     job_binary_id = self.tab_group.kwargs['job_binary_id']
     try:
         job_binary = saharaclient.job_binary_get(request, job_binary_id)
     except Exception:
         job_binary = {}
         exceptions.handle(request, _("Unable to fetch job binary."))
     return {"job_binary": job_binary}
Ejemplo n.º 2
0
 def get_context_data(self, request):
     job_binary_id = self.tab_group.kwargs['job_binary_id']
     try:
         job_binary = saharaclient.job_binary_get(request, job_binary_id)
     except Exception as e:
         job_binary = {}
         LOG.error("Unable to fetch job binary details: %s" % str(e))
     return {"job_binary": job_binary}
Ejemplo n.º 3
0
 def get_context_data(self, request):
     job_binary_id = self.tab_group.kwargs['job_binary_id']
     try:
         job_binary = saharaclient.job_binary_get(request, job_binary_id)
     except Exception:
         job_binary = {}
         exceptions.handle(request,
                           _("Unable to fetch job binary."))
     return {"job_binary": job_binary}
Ejemplo n.º 4
0
 def get_object(self):
     jb_id = self.kwargs["job_binary_id"]
     try:
         return saharaclient.job_binary_get(self.request, jb_id)
     except Exception:
         msg = _('Unable to retrieve details for job binary "%s".') % jb_id
         redirect = reverse(
             "horizon:project:data_processing.job_binaries:job-binaries")
         exceptions.handle(self.request, msg, redirect=redirect)
Ejemplo n.º 5
0
 def get_object(self):
     jb_id = self.kwargs["job_binary_id"]
     try:
         return saharaclient.job_binary_get(self.request, jb_id)
     except Exception:
         msg = _('Unable to retrieve details for job binary "%s".') % jb_id
         redirect = reverse(
             "horizon:project:data_processing.job_binaries:job-binaries")
         exceptions.handle(self.request, msg, redirect=redirect)
Ejemplo n.º 6
0
    def delete(self, request, obj_id):
        jb = saharaclient.job_binary_get(request, obj_id)
        (jb_type, jb_internal_id) = jb.url.split("://")
        if jb_type == "internal-db":
            try:
                saharaclient.job_binary_internal_delete(
                    request, jb_internal_id)
            except api_base.APIException:
                # nothing to do for job-binary-internal if
                # it does not exist.
                pass

        saharaclient.job_binary_delete(request, obj_id)
Ejemplo n.º 7
0
    def action(self, request, obj_id):
        jb = saharaclient.job_binary_get(request, obj_id)
        (jb_type, jb_internal_id) = jb.url.split("://")
        if jb_type == "internal-db":
            try:
                saharaclient.job_binary_internal_delete(request,
                                                        jb_internal_id)
            except api_base.APIException:
                # nothing to do for job-binary-internal if
                # it does not exist.
                pass

        saharaclient.job_binary_delete(request, obj_id)
Ejemplo n.º 8
0
 def get(self, request, job_binary_id=None):
     try:
         jb = saharaclient.job_binary_get(request, job_binary_id)
         data = saharaclient.job_binary_get_file(request, job_binary_id)
     except Exception:
         redirect = reverse(
             'horizon:project:data_processing.job_binaries:index')
         exceptions.handle(self.request,
                           _('Unable to fetch job binary: %(exc)s'),
                           redirect=redirect)
     response = http.HttpResponse(content_type='application/binary')
     response['Content-Disposition'] = ('attachment; filename="%s"' %
                                        jb.name)
     response.write(data)
     response['Content-Length'] = str(len(data))
     return response
Ejemplo n.º 9
0
 def get(self, request, job_binary_id=None):
     try:
         jb = saharaclient.job_binary_get(request, job_binary_id)
         data = saharaclient.job_binary_get_file(request, job_binary_id)
     except Exception:
         redirect = reverse(
             'horizon:project:data_processing.job_binaries:index')
         exceptions.handle(self.request,
                           _('Unable to fetch job binary: %(exc)s'),
                           redirect=redirect)
     response = http.HttpResponse(content_type='application/binary')
     response['Content-Disposition'] = (
         'attachment; filename="%s"' % jb.name)
     response.write(data)
     response['Content-Length'] = str(len(data))
     return response