Example #1
0
    def update_database_results(self, session):
        """Update the database with the results of ramp_test_submission."""
        make_update_leaderboard = False
        while not self._processed_submission_queue.empty():
            make_update_leaderboard = True
            submission_id, submission_name = \
                self._processed_submission_queue.get_nowait()
            if 'error' in get_submission_state(session, submission_id):
                continue
            logger.info('Write info in database for submission {}'.format(
                submission_name))
            path_predictions = os.path.join(
                self._worker_config['predictions_dir'], submission_name)
            # NOTE: In the past we were adding the predictions into the
            # database. Since they require too much space, we stop to store
            # them in the database and instead, keep it onto the disk.
            # set_predictions(session, submission_id, path_predictions)
            set_time(session, submission_id, path_predictions)
            set_scores(session, submission_id, path_predictions)
            set_bagged_scores(session, submission_id, path_predictions)
            set_submission_state(session, submission_id, 'scored')

        if make_update_leaderboard:
            logger.info('Update all leaderboards')
            update_leaderboards(session, self._ramp_config['event_name'])
            update_all_user_leaderboards(session,
                                         self._ramp_config['event_name'])
Example #2
0
 def update_database_results(self, session):
     """Update the database with the results of ramp_test_submission."""
     while not self._processed_submission_queue.empty():
         submission_id, submission_name = \
             self._processed_submission_queue.get_nowait()
         if 'error' in get_submission_state(session, submission_id):
             update_leaderboards(session, self._ramp_config['event_name'])
             update_all_user_leaderboards(session,
                                          self._ramp_config['event_name'])
             logger.info('Skip update for {} due to failure during the '
                         'processing'.format(submission_name))
             continue
         logger.info('Update the results obtained on each fold for '
                     '{}'.format(submission_name))
         path_predictions = os.path.join(
             self._worker_config['predictions_dir'], submission_name
         )
         set_predictions(session, submission_id, path_predictions)
         set_time(session, submission_id, path_predictions)
         set_scores(session, submission_id, path_predictions)
         set_bagged_scores(session, submission_id, path_predictions)
         set_submission_state(session, submission_id, 'scored')
         update_leaderboards(session, self._ramp_config['event_name'])
         update_all_user_leaderboards(session,
                                      self._ramp_config['event_name'])
Example #3
0
def test_check_time(session_scope_module):
    # check both set_time and get_time function
    submission_id = 1
    path_results = os.path.join(HERE, 'data', 'iris_predictions')
    set_time(session_scope_module, submission_id, path_results)
    submission_time = get_time(session_scope_module, submission_id)
    expected_df = pd.DataFrame({
        'fold': [0, 1],
        'train': [0.032130, 0.002414],
        'valid': [0.000583648681640625, 0.000548362731933594],
        'test': [0.000515460968017578, 0.000481128692626953]
    }).set_index('fold')
    assert_frame_equal(submission_time, expected_df, check_less_precise=True)
Example #4
0
    def update_database_results(self, session):
        """Update the database with the results of ramp_test_submission."""
        make_update_leaderboard = False
        while not self._processed_submission_queue.empty():
            make_update_leaderboard = True
            submission_id, submission_name = \
                self._processed_submission_queue.get_nowait()
            if 'error' in get_submission_state(session, submission_id):
                continue
            logger.info('Write info in data base for submission {}'.format(
                submission_name))
            path_predictions = os.path.join(
                self._worker_config['predictions_dir'], submission_name)
            set_predictions(session, submission_id, path_predictions)
            set_time(session, submission_id, path_predictions)
            set_scores(session, submission_id, path_predictions)
            set_bagged_scores(session, submission_id, path_predictions)
            set_submission_state(session, submission_id, 'scored')

        if make_update_leaderboard:
            logger.info('Update all leaderboards')
            update_leaderboards(session, self._ramp_config['event_name'])
            update_all_user_leaderboards(session,
                                         self._ramp_config['event_name'])