def load_file_info(self):
     data_frame_filename = rds.get_value(
         f'{self._redis_prefix}_dataframe_filename')
     self._dataframe_filename = data_frame_filename.decode(
         'utf-8') if data_frame_filename is not None else None
     if not self._dataframe_filename or not os.path.isfile(
             self._dataframe_filename):
         rds.delete_value(f'{self._redis_prefix}_dataframe_filename')
         self._dataframe_filename = None
     try:
         self._loaded_collection_ids = msgpack.loads(
             rds.get_value(f'{self._redis_prefix}_loaded_collection_ids'))
     except TypeError:
         self._loaded_collection_ids = []
Beispiel #2
0
        def update_progress(n_intervals):
            progress = rds.get_value(
                f'{OPLSModel.redis_prefix}_image_save_progress')
            progress_fraction = rds.get_value(
                f'{OPLSModel.redis_prefix}_image_save_progress_fraction')
            label_text = rds.get_value(
                f'{OPLSModel.redis_prefix}_image_save_label')
            job_id = rds.get_value(f'{OPLSModel.redis_prefix}_job_id').decode(
                'utf-8')
            job = Job.fetch(job_id, rds.get_redis())
            job_status = job.get_status()
            if isinstance(label_text, bytes):
                label_text = label_text.decode('utf-8')
            if isinstance(progress, bytes):
                progress = int(float(progress))
            if isinstance(progress_fraction, bytes):
                progress_fraction = progress_fraction.decode('utf-8')

            if job_status == 'finished':
                message = dbc.Alert(f'Prepared plots file as {job.result}.',
                                    color='success',
                                    dismissable=True)
                class_name = 'btn btn-success'
                path = job.result
                progress_label = dbc.FormText(label_text, color='success')
                animated = False
            elif job.get_status() == 'failed':
                message = dbc.Alert(
                    [f'Error occurred.',
                     html.Pre(job.exc_info)],
                    color='danger',
                    dismissable=True)
                class_name = 'btn btn-secondary disabled'
                path = ''
                progress_label = dbc.FormText(label_text, color='danger')
                animated = False
            else:
                message = []
                class_name = 'btn btn-secondary disabled'
                path = ''
                progress_label = dbc.FormText(label_text)
                animated = True
            return progress, animated, progress_fraction, progress_label, url_for(
                'api.download_temporary_file', path=path), class_name, message
 def get_plot_data(cls) -> Dict[str, List[Dict[str, Any]]]:
     try:
         plot_data = msgpack.loads(
             rds.get_value(f'{cls.redis_prefix}_plot_data'), raw=False)
     except Exception as e:
         plot_data = None
     if plot_data is None:
         plot_data = cls._empty_plot_data
     # warning: we don't validate any of this
     return plot_data
Beispiel #4
0
 def processed_numeric_df_label(self):
     val = rds.get_value(f'{self._redis_prefix}_processed_numeric_df_label')
     if val is not None:
         return val.decode('utf-8')
     return 'Processed'
Beispiel #5
0
 def special_numeric_df_label(self):
     val = rds.get_value(f'{self._redis_prefix}_special_numeric_df_label')
     if val is not None:
         return val.decode('utf-8')
     return 'Special'
Beispiel #6
0
 def region_n_clicks(self):
     val = rds.get_value(f'{self._redis_prefix}_region_n_clicks')
     val = int(val) if val is not None else None
     return val
Beispiel #7
0
 def y_axis_range(self):
     val = rds.get_value(f'{self._redis_prefix}_y_axis_range')
     if val is not None:
         return msgpack.loads(val)
     else:
         return [0, 1]
Beispiel #8
0
 def processing_log(self):
     val = rds.get_value(f'{self._redis_prefix}_processing_log')
     if val is not None:
         return val.decode('utf-8')
     return ''
Beispiel #9
0
 def job_id(self):
     try:
         return rds.get_value(f'{self.redis_prefix}_job_id')
     except:
         return None
Beispiel #10
0
 def results_collection_id(self):
     try:
         return msgpack.loads(
             rds.get_value(f'{self.redis_prefix}_results_collection_id'))
     except:
         return None