def pause_task(self, row, scan=True):
if row[STATE_COL] == State.UPLOADING:<EOL><INDENT>self.remove_worker(row[FID_COL], stop=False)<EOL><DEDENT>if row[STATE_COL] in (State.UPLOADING, State.WAITING):<EOL><INDENT>row[STATE_COL] = State.PAUSED<EOL>row[STATENAME_COL] = StateNames[State.PAUSED]<EOL>self.update_task_db(row)<EOL>if scan:<EOL><INDENT>self.scan_tasks()<EOL><DEDENT><DEDENT>
暂停下载任务