def get(self): """Render chat.html if required arguments are present, render main.html otherwise.""" try: group_name = self.get_argument("group_name") user_name = self.get_argument("user_name") res = self.__gh.addNewGroup(group_name, user_name) self.render("templates/chat.html", user_id=res['user_id']) except Exception, e: print e Log(e) self.render("templates/main.html")
def getMemoryleaks(self): res = {'stdout': '', 'stderr': ''} if (self.lang not in C_STYLE_SUPPORED_LANGUAGE): return { 'status': 'error', 'msg': 'we can only have callstack if you are using c or cpp' } try: res = RunCmd(self.memory_leak_cmd, self.input).Run() except Exception as e: LE(e) Log.i('Error: RunCmd Failed..') res['callstack'] = Log(e) return res
def fullrun(self, name=None): res = {'stdout': '', 'stderr': ''} # pdb.set_trace() try: if not LangConfig.get(self.lang): return { 'status': 'error', "msg": "You send a invalid lang in the request" } if LangConfig.get(self.lang).get('compile_is_run') is True: return self.compile() else: # we need to do both res = self.compile() if res['can_run'] == 'yes' and self.testcases: res['testcaseresult'] = [] for tc in self.testcases: ret = self.runwithinput(None, tc['input'] + '\n') comment = '' if ret['is_timeout']: comment = 'Time limit Exceed' elif ret['return_code'] < 0: comment = 'Program Crashed' res['testcaseresult'].append({ 'input': tc['input'], 'expected': tc['output'], 'observed': ret['stdout'], 'comment': comment }) res['msg'] = 'All testcase executed successfully.' return res elif res['can_run'] == 'yes': ret = self.run() if ret['is_timeout']: ret['output'] = 'Time limit Exceed ( Might have an infinite loop ?)' elif ret['return_code'] < 0: ret['output'] = C_RETURN_ERROR_CODE.get( ret['return_code'], "Program crashed due to " + str(ret['return_code'])) + ret['stdout'] return ret else: return res except Exception as e: LE(e) Log.i('Error: fullrun Failed..') res['callstack'] = Log(e) return res