def livy_session_start(request):
    LOGGER.debug('Checking for pre-existing livy sessions')

    # get active livy sessions
    active_ls = LivySession.get_active_session()

    # none found
    if not active_ls:
        LOGGER.debug('active livy session not found, starting')
        livy_session = LivySession()
        livy_session.start_session()

    elif isinstance(active_ls, LivySession) and request.GET.get('restart') == 'true':
        LOGGER.debug(
            'single, active session found, and restart flag passed, restarting')

        # restart
        active_ls.restart_session()

    # redirect
    return redirect('system')
Beispiel #2
0
 def test_livy_session_stop(self):
     livy_session = LivySession()
     livy_session.start_session()
     livy_session.save()
     response = self.client.get(f'/combine/system/livy_sessions/{livy_session.session_id}/stop')
     self.assertRedirects(response, '/combine/system')