def deploy(mode, onlyUp=False): ADD_DEPLOY_CONFIG = ' -f docker-compose.yml.deploy -f docker-compose.yml.%s ' % mode def call_docker_compose_deploy(command): return os.system(env.docker_compose(ADD_DEPLOY_CONFIG + command)) def call_docker_compose_deploy_new(command): return os.system('NEW=_new ' + env.docker_compose(ADD_DEPLOY_CONFIG + command)) if not onlyUp: if 0 != call_docker_compose_deploy_new(env.run(["cd %(output_path)s_new && %(prepare)s"\ %{'prepare': (run.COMMAND_DEPENDENCES + ' && ' + run.COMMAND_PREPARE), 'output_path': VOLUME_PATH}])): return False call_docker_compose_deploy_new(env.down()) if 0 != call_docker_compose_deploy_new(env.run(["cd .. &&\ rm -rf %(output_path)s && mv %(output_path)s_new %(output_path)s"\ %{'output_path': VOLUME_PATH}])): return False if 0 != call_docker_compose_deploy(env.run(["cd .. &&\ rm -rf %(output_path)s_new"\ %{'output_path': VOLUME_PATH}])): return False if 0 != call_docker_compose_deploy(env.run([run.COMMAND_DB_MIGRATE])): return False return 0 == call_docker_compose_deploy(env.up())
def sync(args=[]): if 0 != os.system( env.docker_compose_env( env.run( ['%s && %s' % (COMMAND_DEPENDENCES, COMMAND_DB_MIGRATE)]))): config_info()
def rails_new(args=[]): if 0 == os.system( env.docker_compose_env( env.run([ 'gem install rails && rails new . -d postgresql --webpack=vue' ]))): print(env.line_seperator('=', 80)) print("\n INSTALL FINISH\n") config_info() show_hint()
bought_drugs = 0 no_interaction = 0 refused_sell = 0 skipped_line = 0 print(str(datetime.datetime.now())) #got both if True: for i in range(500): saved_Q_table = dict() #train the model for i in range(500): #1000 [x, x, saved_Q_table] = env.run(Q_table=saved_Q_table, tree=pharm_tree, render=False, learn=True, playable=False) #run the trained model [result, skipped_line_result, x] = env.run(Q_table=saved_Q_table, tree=pharm_tree, render=False, learn=False, playable=False) if result == 0: no_interaction = no_interaction + 1 elif result == 1: stole_drugs = stole_drugs + 1 elif result == 2: bought_drugs = bought_drugs + 1 elif result == 3:
def migrate(args=[]): os.system(env.docker_compose_env(env.run(['%s' % (COMMAND_DB_MIGRATE)])))
def prepare(args=[]): os.system( env.docker_compose_env( env.run(['%s && %s' % (COMMAND_DEPENDENCES, COMMAND_PREPARE)], run_args='--no-deps')))
def rails_reset(args=[]): os.system( env.docker_compose_env( env.run(['%s && %s' % (COMMAND_DROP, COMMAND_DB_SEED)])))
def rails_drop(args=[]): os.system(env.docker_compose_env(env.run([COMMAND_DROP])))
def rails_c(args=[]): os.system(env.docker_compose_env(env.run(['rails c'])))