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!")
#! /usr/bin/env python import docker import os from zmq.eventloop import ioloop from juliabox.srvr_jbapi import JBoxAPI from juliabox.jbox_util import JBoxCfg if __name__ == "__main__": ioloop.install() conf_dir = os.path.abspath( os.path.join(os.path.dirname(__file__), '../conf')) conf_file = os.path.join(conf_dir, 'tornado.conf') user_conf_file = os.path.join(conf_dir, 'jbox.user') JBoxCfg.read(conf_file, user_conf_file) JBoxCfg.dckr = docker.Client() JBoxAPI().run()
return new_img_file, new_pkg_file 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)