Exemple #1
0
 def do_handle_upload(self, handid, hw, form):
     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_python.delay(handid, hw.uuid, fcnt, {'filename': filename})
Exemple #2
0
    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_python.delay(handid, hw.uuid, fcnt, {'filename': filename}, os.path.join(user_handid_submit, 'result.csv'))
Exemple #3
0
    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_python.delay(handid, hw.uuid, fcnt, {'filename': fname}, os.path.join(user_handid_submit, 'result.csv'))
Exemple #4
0
 def do_rerun(self, handid, hw, stored_content):
     fcnt, fname = stored_content['fcnt'], stored_content['fname']
     run_python.delay(handid, hw.uuid, fcnt, {'filename': fname})
Exemple #5
0
 def do_rerun(self, handid, hw, stored_content):
     fcnt, fname = stored_content['fcnt'], stored_content['fname']
     run_python.delay(handid, hw.uuid, fcnt, {'filename': fname})