def stop_app(self, c_app, stop_code=None, stop_message=None): # flask_log(" ========= STOP_APP ====================") if not c_app or 'task_id' not in c_app: print_flush('Cannot stop invalid app') return from tasks.celery import app if not c_app.get('is_default', False) and not c_app.get('is_forced', False): if stop_code and stop_message and 'userid' in c_app: Websock.send_data(stop_code, stop_message, c_app['username'], c_app['userid']) app.control.revoke(c_app['task_id'], terminate=True) self.frontage.fade_out() SchedulerState.set_current_app({})
def stop_app(self, c_app, stop_code=None, stop_message=None): # flask_log(" ========= STOP_APP ====================") if not c_app or 'task_id' not in c_app: return from tasks.celery import app if not c_app.get('is_default', False) and not c_app.get( 'is_forced', False): if stop_code and stop_message and 'userid' in c_app: Websock.send_data(stop_code, stop_message, c_app['username'], c_app['userid']) sleep(0.1) # revoke(c_app['task_id'], terminate=True, signal='SIGUSR1') # app.control.revoke(c_app['task_id'], terminate=True, signal='SIGUSR1') app.control.revoke(c_app['task_id'], terminate=True) self.frontage.fade_out() sleep(0.05)
def send_expires_soon(timeout_in_sec, username='', userid=''): SchedulerState.set_expire_soon(True) Websock.send_data(Fap.CODE_EXPIRE_SOON, timeout_in_sec, username, userid)
def send_expires(username='', userid=''): SchedulerState.set_expire(True) Websock.send_data(Fap.CODE_EXPIRE, 'EXPIRE', username, userid)
def send_message(self, code): Websock.send_data(code, 'Gamelife message', self.username, self.userid)
def send_game_over(self): Websock.send_data(Fap.CODE_GAME_OVER, 'GAME_OVER', self.username, self.userid)
def send_close_app(self): Websock.send_data(Fap.CODE_CLOSE_APP, 'CLOSING', self.username, self.userid)
def send_pixel_down(self, positions): print_flush("Sending positions to frontend...") #print_flush(positions) Websock.send_data(positions, 'Pixel down message', self.username, self.userid)