def GET(self, request): """ Get the status of the vazels control centre. :returns: The current control centre status, either * ``"{'control_centre_status': 'running'}"`` * ``"{'control_centre_status': 'ready'}"`` * ``"{'control_centre_status': <somethingelse>}"`` where ``<somethingelse>`` is a return value of :func:`vazelsmanager.vazelsRunning()` """ authentication.login(request) return request.response({"control_centre_status": commandclient.vazelsPhase()})
def GET(self, request): """ Get the tgz archive of the probe folder. The filename of the resulting file will be taken by the browser from the location this handler was attached to. .. todo:: Work out why FF cannot open this fil directly (without saving it first) .. todo:: Allow this file through the testing proxy. :raises: :exc:`restlite.Status` 400 if the experiment is not set up. :exc:`restlite.Status` 500 if the folder could not be served. """ authentication.login(request) if commandclient.vazelsPhase() != commandclient.Statuses["STATUS_RUNNING"]: raise restlite.Status, "400 Can't get the Probe until the experiment is set up" probePath = os.path.join(controlcentre.getExperimentPath(), "Probe_Folder") with tempfile.SpooledTemporaryFile(1024) as temp: tar = tarfile.open(fileobj=temp, mode="w:gz") tar.add(name=probePath, arcname="Probe_Folder") tar.close() temp.seek(0) # Don't have this in the return statement # It will break EVERYTHING mysteriously content = temp.read() return request.response(content, "application/x-gzip") raise restlite.Status, "500 Could Not Serve Probe File"