Exemple #1
0
def get_vessel_acquisition_counts_by_user():

  # Set the log level high enough so that we don't produce a bunch of logging
  # output due to the logging decorators.
  initial_log_level = log.loglevel
  log.set_log_level(log.LOG_LEVEL_INFO)
  
  vessel_acquisition_dict = {}
  
  for user in GeniUser.objects.all():
    acquired_vessels = maindb.get_acquired_vessels(user)
    if len(acquired_vessels) > 0:
      vessel_acquisition_dict[user.username] = len(acquired_vessels)
      
  # Restore the original log level.
  log.set_log_level(initial_log_level)
      
  return vessel_acquisition_dict
Exemple #2
0
def get_available_vessel_counts_by_port():

  # Set the log level high enough so that we don't produce a bunch of logging
  # output due to the logging decorators.
  initial_log_level = log.loglevel
  log.set_log_level(log.LOG_LEVEL_INFO)

  available_vessels_dict = {}
  
  for port in maindb.ALLOWED_USER_PORTS:
    available_vessels_dict[port] = {}
    available_vessels_dict[port]["all"] = maindb._get_queryset_of_all_available_vessels_for_a_port_include_nat_nodes(port).count()
    available_vessels_dict[port]["no_nat"] = maindb._get_queryset_of_all_available_vessels_for_a_port_exclude_nat_nodes(port).count()
    available_vessels_dict[port]["only_nat"] = maindb._get_queryset_of_all_available_vessels_for_a_port_only_nat_nodes(port).count()
  
  # Restore the original log level.
  log.set_log_level(initial_log_level)
  
  return available_vessels_dict
Exemple #3
0
def get_donation_counts_by_user():
  
  # Set the log level high enough so that we don't produce a bunch of logging
  # output due to the logging decorators.
  initial_log_level = log.loglevel
  log.set_log_level(log.LOG_LEVEL_INFO)
  
  donation_dict = {}
  
  for user in GeniUser.objects.all():
    active_donation_count = len(maindb.get_donations_by_user(user))
    inactive_donation_count = len(maindb.get_donations_by_user(user, include_inactive_and_broken=True)) - active_donation_count
    if active_donation_count > 0 or inactive_donation_count > 0:
      donation_dict[user.username] = (active_donation_count, inactive_donation_count)
      
  # Restore the original log level.
  log.set_log_level(initial_log_level)
      
  return donation_dict
"""

import sys
import time

from seattlegeni.common.api import lockserver
from seattlegeni.common.api import maindb
from seattlegeni.common.util import log

from seattlegeni.common.exceptions import *


# Set the log level high enough so that we don't produce a bunch of logging
# output due to the logging decorators.
initial_log_level = log.loglevel
log.set_log_level(log.LOG_LEVEL_INFO)



def stop_all_vessels_on_node(node_id):

  try:
    node = maindb.get_node(node_id)
  except DoesNotExistError:
    print "No such node"
    sys.exit(1)

  if not node.is_active:
    print "This node is marked as inactive, thus the backend will not try to clean up vessels."
    sys.exit(0)
Exemple #5
0


# If DEBUG is True, then error details will be shown on the website and ADMINS
# will not receive an email when an error occurs. So, this should be False in
# production.
DEBUG = True
TEMPLATE_DEBUG = DEBUG

# The log level used by the seattlegeni log module. All messages at this level
# or more severe will be logged.
SEATTLECLEARINGHOUSE_LOG_LEVEL = log.LOG_LEVEL_DEBUG

# Rather than make the log module have to import this settings file to set the
# log level, just set it right here.
log.set_log_level(SEATTLECLEARINGHOUSE_LOG_LEVEL)

# This is needed to allow xmlrpc requests to work when they don't have a slash
# on the end of the url.
APPEND_SLASH = False

# The directory the settings.py file is in is what we consider the root of the website. 
SEATTLECLEARINGHOUSE_WEBSITE_ROOT = os.path.dirname(__file__)

# The directory where we keep the public keys of the node state keys.
SEATTLECLEARINGHOUSE_STATE_KEYS_DIR = os.path.join(SEATTLECLEARINGHOUSE_WEBSITE_ROOT, '..', 'node_state_transitions', 'statekeys')

# The XML-RPC interface to the Custom Installer Builder.
SEATTLECLEARINGHOUSE_INSTALLER_BUILDER_XMLRPC = "https://custombuilder.poly.edu/custom_install/xmlrpc/"

# Not currently used. This is left in for legacy installs
Exemple #6
0
  You will be given status information as the process is completed.
"""

import sys
import time

from seattlegeni.common.api import lockserver
from seattlegeni.common.api import maindb
from seattlegeni.common.util import log

from seattlegeni.common.exceptions import *

# Set the log level high enough so that we don't produce a bunch of logging
# output due to the logging decorators.
initial_log_level = log.loglevel
log.set_log_level(log.LOG_LEVEL_INFO)


def stop_all_vessels_on_node(node_id):

    try:
        node = maindb.get_node(node_id)
    except DoesNotExistError:
        print "No such node"
        sys.exit(1)

    if not node.is_active:
        print "This node is marked as inactive, thus the backend will not try to clean up vessels."
        sys.exit(0)

    if node.is_broken:
Exemple #7
0
new_middleware_classes.remove('django.contrib.csrf.middleware.CsrfResponseMiddleware')
settings.MIDDLEWARE_CLASSES = tuple(new_middleware_classes)

import django.db

import django.test.utils

from seattlegeni.common.util import log





# Turn off most logging to speed up tests run manually. This can be removed
# to see the plentiful debug output.
log.set_log_level(log.LOG_LEVEL_CRITICAL)





def setup_test_environment():
  """
  Called once before running one or more tests. Must be called before calling
  setup_test_db().
  """
  
  django.test.utils.setup_test_environment()


Exemple #8
0
new_middleware_classes = list(settings.MIDDLEWARE_CLASSES)
new_middleware_classes.remove(
    'django.contrib.csrf.middleware.CsrfViewMiddleware')
new_middleware_classes.remove(
    'django.contrib.csrf.middleware.CsrfResponseMiddleware')
settings.MIDDLEWARE_CLASSES = tuple(new_middleware_classes)

import django.db

import django.test.utils

from seattlegeni.common.util import log

# Turn off most logging to speed up tests run manually. This can be removed
# to see the plentiful debug output.
log.set_log_level(log.LOG_LEVEL_CRITICAL)


def setup_test_environment():
    """
  Called once before running one or more tests. Must be called before calling
  setup_test_db().
  """

    django.test.utils.setup_test_environment()


def teardown_test_environment():
    """
  Called once after running one or more tests. That is, this should be called
  before the test script exits.
Exemple #9
0


# If DEBUG is True, then error details will be shown on the website and ADMINS
# will not receive an email when an error occurs. So, this should be False in
# production.
DEBUG = True
TEMPLATE_DEBUG = DEBUG

# The log level used by the seattlegeni log module. All messages at this level
# or more severe will be logged.
LOG_LEVEL = log.LOG_LEVEL_DEBUG

# Rather than make the log module have to import this settings file to set the
# log level, just set it right here.
log.set_log_level(LOG_LEVEL)

# This is needed to allow xmlrpc requests to work when they don't have a slash
# on the end of the url.
APPEND_SLASH = False

# The directory the settings.py file is in is what we consider the root of the website. 
WEBSITE_ROOT = os.path.dirname(__file__)

# The directory where we keep the public keys of the node state keys.
STATE_KEYS_DIR = os.path.join(WEBSITE_ROOT, '..', 'node_state_transitions', 'statekeys')

# The XML-RPC interface to the Custom Installer Builder.
INSTALLER_BUILDER_XMLRPC = "https://seattlegeni.cs.washington.edu/custom_install/xmlrpc/"

# The directory where the base installers named seattle_linux.tgz, seattle_mac.tgz,