Beispiel #1
0
def judge_init():
    want_import(globals(), '*')
    global option_values
    option_values = setup()
    try:
        judge_initialize()
        while True:
            try:
                judge_loop()
            except:
                traceback.print_exc()
            time.sleep(10)
    except:
        traceback.print_exc()
    finally:
        judge_finalize()
Beispiel #2
0
def main():
    from satori.tools import options, setup

    options.add_argument('--ipython', help='Use IPython', action='store_true')
    flags = setup(logging.INFO)

    if flags.ipython:
        from satori.client.common import want_import
        want_import(globals(), "*")
        from IPython import embed
        embed()
    else:
        import code
        console = code.InteractiveConsole()
        console.runcode('from satori.client.common import want_import')
        console.runcode('want_import(globals(), "*")')
        console.interact()
Beispiel #3
0
def main():
    from satori.tools import options, setup

    options.add_argument('--ipython', help='Use IPython', action='store_true')
    flags = setup(logging.INFO)

    if flags.ipython:
        from satori.client.common import want_import
        want_import(globals(), "*")
        from IPython import embed
        embed()
    else:
        import code
        console = code.InteractiveConsole()
        console.runcode('from satori.client.common import want_import')
        console.runcode('want_import(globals(), "*")')
        console.interact()
Beispiel #4
0
# vim:ts=4:sts=4:sw=4:expandtab
from satori.client.common import want_import
want_import(globals(), '*')
from satori.web.utils.decorators import contest_view
from django import forms
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from satori.web.utils.tables import *

# TODO(robryk): Decouple descriptive filename from actual blob filename
# The core wishes to receive blobs with proper file names ([0-9A-Za-z._-]*).
# We do not wish to impose same rules on filenames of files to be printed
# and we don't care about the exact name (it is printed out on the printout
# and possibly by a2ps to detect file type).
def is_legal_char(c):
    return c == '.' or c == '-' or c == '_' or c.isalpha() or c.isdigit()

def sanitize_filename(filename):
    return ''.join([x for x in filename if is_legal_char(x)])

@contest_view
def view(request, page_info):
    contest = page_info.contest
    contestant = page_info.contestant
    is_admin = page_info.contest_is_admin
    class PrintForm(forms.Form):
        codefile = forms.FileField(label='Print file',required=True)

    class PrintTable(ResultTable):
        def default_limit(self):
Beispiel #5
0
# vim:ts=4:sts=4:sw=4:expandtab
from satori.client.common import want_import
want_import(globals(), '*')
from satori.web.utils.decorators import contest_view
from satori.web.utils.tables import *
from django.shortcuts import render_to_response
from django.core.urlresolvers import reverse
from django import forms


def getfield(obj, *args, **kwargs):
    default = kwargs.get('default', None)
    ret = obj
    for a in args:
        if hasattr(ret, a):
            ret = getattr(ret, a)
        else:
            return default
    return ret


@contest_view
def view(request, page_info):
    contest = page_info.contest
    admin = page_info.contest_is_admin

    class SubmitsTable(ResultTable):
        def length(self):
            return len(self.results)

        @staticmethod
Beispiel #6
0
# vim:ts=4:sts=4:sw=4:expandtab

from satori.client.common import want_import, remote
import ConfigParser
import getpass
import logging
import argparse
import os
import sys

want_import(globals(), 'Machine', 'User', 'token_container', 'TokenInvalid', 'TokenExpired')

config = ConfigParser.RawConfigParser()
options = argparse.ArgumentParser()
thrift_settings = options.add_argument_group('thrift settings')
thrift_settings.add_argument('-c', '--config', help='alternative configuration file')
thrift_settings.add_argument('-s', '--section', help='section from configuration file to use')
thrift_settings.add_argument('-H', '--host', help='Satori host in format host_name:thrift_port:blob_port')
thrift_settings.add_argument('-u', '--username', help='user name (or "-" to skip authentication)')
thrift_settings.add_argument('-p', '--password', help='password')
thrift_settings.add_argument('-m', '--machine', help='machine name (or "-" to skip authentication)')
thrift_settings.add_argument('-S', '--ssl', help='use SSL', action='store_true')
options.add_argument('-l', '--loglevel', type=int, help='Log level (as in logging module in python)')

class AuthSetup:
    def __init__(self):
        self.clear()

    def clear(self):
        self.section = None
        self.hostname = None