Sets the flag indicating that the task should also run after the optimisation is ended.
778638
def with_exit_condition(self, exit_condition: Optional[bool]=True) -> 'MonitorTask':
        
        self._exit_condition = exit_condition
        return self
1107769
@Override
    public void finishTraining(long originatorId, long taskId) {
        // on Master thread we'll be applying final gradients

        if (params != null && stepFunction != null) {
            if (hasSomething.get()) {
                stepFunction.step(params, updates);
                //Nd4j.getMemoryManager().memset(updates);
                updates.assign(0.0);
            }
        }

    }
516193
def _on_iteration(self, *args, **kwargs) -> None:
        

        # Update timing and the iteration number in the monitoring context.
        current_timestamp = get_hr_time()
        self._context.optimisation_time += current_timestamp - self._last_timestamp
        self._context.total_time = current_timestamp - self._start_timestamp
        self._context.optimiser_updated = False
        if not self._context.optimisation_finished:
            self._context.iteration_no += 1

        # Call all monitoring functions
        for func in self._monitor_tasks:
            func(self._context, *args, **kwargs)

        # Remember the time when the control is returned back to the optimiser, so that the next
        # optimisation step can be accurately timed.
        self._last_timestamp = get_hr_time()
297712
@UnstableApi
    public final void executeAfterEventLoopIteration(Runnable task) {
        ObjectUtil.checkNotNull(task, "task");
        if (isShutdown()) {
            reject();
        }

        if (!tailTasks.offer(task)) {
            reject(task);
        }

        if (wakesUpForTask(task)) {
            wakeup(inEventLoop());
        }
    }
520220
def set(self):
        
        self._flag = True
        old_future = self._waiting_future
        # Replace _waiting_future with a fresh one incase someone woken up by set_result()
        # sets this AsyncEvent to False before waiting on it to be set again.
        self._waiting_future = tornado_Future()
        old_future.set_result(True)
1308776
public void endTiming() {
		if (_callback != null) {
			float elapsed = System.currentTimeMillis() - _start;
			_callback.endTiming(_counter, elapsed);
		}
	}
418440
def task_done(self, task_id, result):
        """"""
        try:
            task = self.tasks.pop(task_id)
        except KeyError:
            return  # result of previously timeout Task
        else:
            if task.future.cancelled():
                task.set_running_or_notify_cancel()
            elif isinstance(result, BaseException):
                task.future.set_exception(result)
            else:
                task.future.set_result(result)

            self.task_done_callback()
461332
def finish(self):
        """"""
        self._my_map['over'] = True  # finished == over?
        self._my_map['completionTime'] = DateTime.utcnow()
        self._save()
432410
function() {
            if (_.keys(children).length == 0) {
              that.stop(process.exit);
            }
            else {
              setImmediate(checkExit);   // keep polling for safe shutdown.
            }
          }
421959
def run(self):
        '''
        '''
        if self.verbose:
            pbar = tqdm(total=100)
        while True:
            task_remain = self._task_queue.qsize()
            task_finished = int((float(self.total_task - task_remain) /
                                 float(self.total_task)) * 100)
            if task_finished % 20 == 0 and task_finished != self.current_state:
                self.current_state = task_finished
                logger.info('{0}% done'.format(task_finished))
                if self.verbose and task_finished > 0:
                    pbar.update(20)
            if task_remain == 0:
                break
        logger.debug('All task data cleared')
1142469
def _wait_for_finishing(self):
        """"""
        self.state_machine_running = True
        self.__running_state_machine.join()
        self.__set_execution_mode_to_finished()
        self.state_machine_manager.active_state_machine_id = None
        plugins.run_on_state_machine_execution_finished()
        # self.__set_execution_mode_to_stopped()
        self.state_machine_running = False
394383
def watch(self, flag):
        """"""
        lib.EnvSetDeftemplateWatch(self._env, int(flag), self._tpl)
1040980
void registerTaskEnded(Task task) {
        synchronized (m_activeTasks) {
            String mapKey = createMapKey(task.getTenant(), task.getTaskID());
            if (m_activeTasks.remove(mapKey) == null) {
                m_logger.warn("Task {} registered as ended but was not running", mapKey);
            }
        }
    }
1088775
public void finish() {
        if ( finSignal == null && finished )
            return;
        // signal finish of execution, so remoting can clean up callback id mappings
        // override if always single result or finish can be emitted by the remote method
        // note one can send FINSILENT to avoid the final message to be visible to receiver callback/spore
        cb.complete(null, null);
        finished = true;
    }
813188
def _finalize(self):
        """"""
        if self.status in ['running', 'halt']:
            if self.verbose > 0:
                print_('\nSampling finished normally.')
            self.status = 'ready'

        self.save_state()
        self.db._finalize()
903782
def on_finished(self):
        """"""
        self.controller.is_running = False

        error = self.controller.current_error
        if error is not None:
            self.info(self.tr("Stopped due to error(s), see Terminal."))
        else:
            self.info(self.tr("Finished successfully!"))
1246539
def _set_future_result(self):
        """"""
        # This must be done in a lock to prevent the polling thread
        # and main thread from both executing the completion logic
        # at the same time.
        with self._completion_lock:
            # If the operation isn't complete or if the result has already been
            # set, do not call set_result/set_exception again.
            # Note: self._result_set is set to True in set_result and
            # set_exception, in case those methods are invoked directly.
            if self.state != _DONE_STATE or self._result_set:
                return

            if self.error_result is not None:
                exception = _error_result_to_exception(self.error_result)
                self.set_exception(exception)
            else:
                self.set_result(self)