def get(self, request, *args, **kwargs): auditor.record(event_type=EXPERIMENT_LOGS_VIEWED, instance=self.experiment, actor_id=request.user.id, actor_name=request.user.username) if self.experiment.is_distributed: logs_path = get_experiment_job_logs_path(experiment=self.experiment, job=self.job) else: logs_path = get_experiment_logs_path(experiment=self.experiment) if not logs_path: return Response(status=status.HTTP_404_NOT_FOUND, data='Experiment has no logs.') return stream_file(file_path=logs_path, logger=_logger)
def get(self, request, *args, **kwargs): auditor.record(event_type=JOB_LOGS_VIEWED, instance=self.job, actor_id=request.user.id, actor_name=request.user.username) job_name = self.job.unique_name if self.job.is_done: log_path = stores.get_job_logs_path(job_name=job_name, temp=False) log_path = archive_logs_file(log_path=log_path, namepath=job_name) else: process_logs(job=self.job, temp=True) log_path = stores.get_job_logs_path(job_name=job_name, temp=True) return stream_file(file_path=log_path, logger=_logger)
def get(self, request, *args, **kwargs): filepath = request.query_params.get('path') if not filepath: raise ValidationError('Files view expect a path to the file.') job_outputs_path = stores.get_job_outputs_path( persistence=self.job.persistence_outputs, job_name=self.job.unique_name) download_filepath = archive_outputs_file(persistence_outputs=self.job.persistence_outputs, outputs_path=job_outputs_path, namepath=self.job.unique_name, filepath=filepath) if not download_filepath: return Response(status=status.HTTP_404_NOT_FOUND, data='Outputs file not found: log_path={}'.format(download_filepath)) return stream_file(file_path=download_filepath, logger=_logger)