def do_handle_upload(self, handid, hw, form): filename = form.handin.data.filename scontent = form.handin.data.stream.read() fcnt = base64.b64encode(scontent) if not os.path.isdir(app.config['SUBMIT_DIR']): os.mkdir(app.config['SUBMIT_DIR']) user_submit = os.path.join(app.config['SUBMIT_DIR'],current_user.name) if not os.path.isdir(user_submit): os.mkdir(user_submit) user_name_submit = os.path.join(user_submit,hw.info.name) if not os.path.isdir(user_name_submit): os.mkdir(user_name_submit) user_handid_submit = os.path.join(user_name_submit,handid) if not os.path.isdir(user_handid_submit): os.mkdir(user_handid_submit) if app.config['ALLOW_LOG']: f = codecs.open(os.path.join(user_handid_submit,filename),'w') f.write(scontent) f.close() # We store the user uploaded file in local storage! self.store_content(handid, {'fname': filename, 'fcnt': fcnt}) # Push the submission to run queue run_java.delay(handid, hw.uuid, fcnt, {'filename': filename}, os.path.join(user_handid_submit, 'result.csv'))
def do_handle_upload(self, handid, hw, form): print 'this is java' filename = form.handin.data.filename fcnt = base64.b64encode(form.handin.data.stream.read()) # We store the user uploaded file in local storage! self.store_content(handid, {'fname': filename, 'fcnt': fcnt}) # Push the submission to run queue run_java.delay(handid, hw.uuid, fcnt, {'filename': filename})
def do_rerun(self, handid, hw, stored_content): fcnt, fname = stored_content['fcnt'], stored_content['fname'] if not os.path.isdir(app.config['SUBMIT_DIR']): os.mkdir(app.config['SUBMIT_DIR']) user_submit = os.path.join(app.config['SUBMIT_DIR'],current_user.name) if not os.path.isdir(user_submit): os.mkdir(user_submit) user_name_submit = os.path.join(user_submit,hw.info.name) if not os.path.isdir(user_name_submit): os.mkdir(user_name_submit) user_handid_submit = os.path.join(user_name_submit,handid) if not os.path.isdir(user_handid_submit): os.mkdir(user_handid_submit) run_java.delay(handid, hw.uuid, fcnt, {'filename': fname}, os.path.join(user_handid_submit, 'result.csv'))
def do_rerun(self, handid, hw, stored_content): print 'this is java' fcnt, fname = stored_content['fcnt'], stored_content['fname'] run_java.delay(handid, hw.uuid, fcnt, {'filename': fname})