예제 #1
0
def process_commands(argv):
    with open(argv[2]) as f:
        uplcourse = eval(f.read())

    conf_dir = os.path.abspath(
        os.path.join(os.path.dirname(__file__), '../../host/tornado/conf'))
    conf_file = os.path.join(conf_dir, 'tornado.conf')
    user_conf_file = os.path.join('/jboxengine/conf', 'jbox.user')

    JBoxCfg.read(conf_file, user_conf_file)

    LoggerMixin.configure()
    db.configure()
    Compute.configure()

    cmd = argv[1]
    if cmd == "upload":
        HomeworkHandler.upload_course(None, uplcourse)
    elif cmd == "report":
        as_csv = (argv[3] == "csv") if len(argv) > 3 else False
        get_report(uplcourse, as_csv)
    elif cmd == "answers":
        get_answers(uplcourse)
    else:
        print("Unknown option %s" % (cmd, ))

    print("DONE!")
예제 #2
0
 def init():
     LoggerMixin.configure()
     db.configure()
     VolMgr.configure()
예제 #3
0
 def init():
     LoggerMixin.configure()
     db.configure()
     VolMgr.configure()
     JBoxDisk.PLUGIN = JBPluginCloud.jbox_get_plugin(
         JBPluginCloud.JBP_BUCKETSTORE)
예제 #4
0
def copy_for_boot():
    for f in (JBoxVol.USER_HOME_IMG, JBoxVol.PKG_IMG):
        dname, fname = os.path.split(f)
        copyname = expanduser(os.path.join("~", fname))
        shutil.copyfile(f, copyname)


if __name__ == "__main__":
    conf_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../engine/conf'))
    conf_file = os.path.join(conf_dir, 'tornado.conf')
    user_conf_file = os.path.join('/jboxengine/conf', 'jbox.user')

    JBoxCfg.read(conf_file, user_conf_file)
    JBoxCfg.dckr = docker.Client()

    LoggerMixin.configure()
    db.configure()
    SessContainer.configure()
    VolMgr.configure()

    plugin = JBPluginCloud.jbox_get_plugin(JBPluginCloud.JBP_BUCKETSTORE)
    if plugin is None:
        VolMgr.log_error("No plugin found for bucketstore")
        exit(1)

    ts = JBoxVol._get_user_home_timestamp()
    tsstr = ts.strftime("%Y%m%d_%H%M")
    VolMgr.log_debug("user_home_timestamp: %s", tsstr)

    imgf, pkgf = copy_for_upload(tsstr)
    copy_for_boot()
예제 #5
0
 def init():
     LoggerMixin.configure()
     db.configure()
     VolMgr.configure()
     JBoxDisk.PLUGIN = JBPluginCloud.jbox_get_plugin(JBPluginCloud.JBP_BUCKETSTORE)