Update task ttl and/or ttr by increment value

            :param task_id: Task id
            :param increment: Seconds to add to ttr
            :return: Task instance
353216
async def touch(self, task_id, increment):
        
        args = (task_id, increment)
        res = await self.conn.call(self.__funcs['touch'], args)
        return self._create_task(res.body)
329157
def wait(self, task_id):
        
        data = {
            'action': 'wait',
            'id': task_id
        }
        self.__send_pyobj(data)
        task = self.__recv_pyobj(notimeout=True)
        return task
5857
def _update_cache(self, course, taskid):
        
        if not id_checker(taskid):
            raise InvalidNameException("Task with invalid name: " + taskid)

        task_fs = self.get_task_fs(course.get_id(), taskid)
        last_modif, translation_fs, task_content = self._get_last_updates(course, taskid, task_fs, True)

        self._cache[(course.get_id(), taskid)] = (
            self._task_class(course, taskid, task_content, task_fs, translation_fs, self._hook_manager, self._task_problem_types),
            last_modif
        )
1194626
def __update(self, task_source):
		
		next_start = task_source.next_start()
		if next_start is not None:

			if next_start.tzinfo is None or next_start.tzinfo != timezone.utc:
				raise ValueError('Invalid timezone information')

			if self.__next_start is None or next_start < self.__next_start:
				self.__next_start = next_start
				self.__next_sources = [task_source]
			elif next_start == self.__next_start:
				self.__next_sources.append(task_source)
108722
def add(self, task, multiprocess=False, processes=0):
        
        if self._first_task is None and hasattr(task, 'task_id'):
            self._first_task = task.task_id
        self.add_succeeded = True
        if multiprocess:
            queue = multiprocessing.Manager().Queue()
            pool = multiprocessing.Pool(processes=processes if processes > 0 else None)
        else:
            queue = DequeQueue()
            pool = SingleProcessPool()
        self._validate_task(task)
        pool.apply_async(check_complete, [task, queue])

        # we track queue size ourselves because len(queue) won't work for multiprocessing
        queue_size = 1
        try:
            seen = {task.task_id}
            while queue_size:
                current = queue.get()
                queue_size -= 1
                item, is_complete = current
                for next in self._add(item, is_complete):
                    if next.task_id not in seen:
                        self._validate_task(next)
                        seen.add(next.task_id)
                        pool.apply_async(check_complete, [next, queue])
                        queue_size += 1
        except (KeyboardInterrupt, TaskException):
            raise
        except Exception as ex:
            self.add_succeeded = False
            formatted_traceback = traceback.format_exc()
            self._log_unexpected_error(task)
            task.trigger_event(Event.BROKEN_TASK, task, ex)
            self._email_unexpected_error(task, formatted_traceback)
            raise
        finally:
            pool.close()
            pool.join()
        return self.add_succeeded
448038
def increment(self, key, value=1):
        
        return self._redis.incrby(self._prefix + key, value)
83585
function increment(redisClient, amount, keyPrepend, key, callback) {

    if (typeof amount !== 'number') {
        callback("increment amount is not number");
        return;
    }

    var multi = redisClient.multi();

    // Chain each redis command.
    incrementMinute(multi, amount, keyPrepend, key);
    incrementHour(multi, amount, keyPrepend, key);
    incrementDays(multi, amount, keyPrepend, key);
    incrementWeeks(multi, amount, keyPrepend, key);

    // Do it
    multi.exec(callback);

}
1039452
def UpdateTaskAsPendingMerge(self, task):
    
    with self._lock:
      is_abandoned = task.identifier in self._tasks_abandoned
      is_processing = task.identifier in self._tasks_processing
      is_queued = task.identifier in self._tasks_queued

      if not is_queued and not is_processing and not is_abandoned:
        raise KeyError('Status of task {0:s} is unknown.'.format(
            task.identifier))

      if is_abandoned and task.has_retry:
        raise KeyError('Will not merge a task {0:s} with retry task.'.format(
            task.identifier))

      if is_queued:
        logger.debug('Task {0:s} was queued, now merging.'.format(
            task.identifier))
        del self._tasks_queued[task.identifier]

      if is_processing:
        logger.debug('Task {0:s} was processing, now merging.'.format(
            task.identifier))
        del self._tasks_processing[task.identifier]

      if is_abandoned:
        logger.debug('Task {0:s} was abandoned, now merging.'.format(
            task.identifier))
        del self._tasks_abandoned[task.identifier]

      self._tasks_pending_merge.PushTask(task)

      self.SampleTaskStatus(task, 'pending_merge')

      task.UpdateProcessingTime()
      self._UpdateLatestProcessingTime(task)
1227608
def _add_task(self, tile_address, coroutine):
        

        self.verify_calling_thread(True, "_add_task is not thread safe")

        if tile_address not in self._tasks:
            self._tasks[tile_address] = []

        task = self._loop.create_task(coroutine)
        self._tasks[tile_address].append(task)
1068191
def add_tasks(self, value):
        
        tasks = self._validate_entities(value)
        self._tasks.update(tasks)
        self._task_count = len(self._tasks)
847987
def task_log(self):
        
        if self.task_id is None:
            raise ValueError('task_id is None')
        return self.get_task_log(self.task_id, self.session, self.request_kwargs)
456417
def update_case_task(self, task):
        
        req = self.url + "/api/case/task/{}".format(task.id)

        # Choose which attributes to send
        update_keys = [
            'title', 'description', 'status', 'order', 'user', 'owner', 'flag', 'endDate'
        ]

        data = {k: v for k, v in task.__dict__.items() if k in update_keys}

        try:
            return requests.patch(req, headers={'Content-Type': 'application/json'}, json=data,
                                  proxies=self.proxies, auth=self.auth, verify=self.cert)
        except requests.exceptions.RequestException as e:
            raise CaseTaskException("Case task update error: {}".format(e))
780684
def increment_counter(self, id, counter_name, increment=1,
                          id_name='id', **kwargs):
        
        response = self._new_response()
        if self._check_supported_op('increment_counter', response):
            params = {
                'Key': {id_name: id},
                'UpdateExpression': 'set #ctr = #ctr + :val',
                'ExpressionAttributeNames': {"#ctr": counter_name},
                'ExpressionAttributeValues': {
                    ':val': decimal.Decimal(increment)},
                'ReturnValues': 'UPDATED_NEW'
            }
            self._call_ddb_method(self.table.update_item, params, response)
            if response.status == 'success':
                if 'Attributes' in response.raw_response:
                    self._replace_decimals(response.raw_response)
                    attr = response.raw_response['Attributes'][counter_name]
                    response.data = attr
        response.prepare()
        return response
814454
def task_progress(task_or_id)
      task_id = task_or_id.is_a?(Hash) ? task_or_id['id'] : task_or_id
      if !task_id.empty?
        options = { verbosity: @context[:verbosity] || HammerCLI::V_VERBOSE }
        task_progress = TaskProgress.new(task_id, options) { |id| load_task(id) }
        task_progress.render
        task_progress.success?
      else
        signal_usage_error(_('Please mention appropriate attribute value'))
      end
    end
814417
def _heartbeat(self, queue, task_ids):
        
        now = time.time()
        self.connection.zadd(self._key(ACTIVE, queue),
                             **{task_id: now for task_id in task_ids})
651430
def update_status(self):
        
        task = self.make_request(
            TaskRunFailed,
            href=self.href)

        return Task(task)
135976
def add_source(self, task_source):
		
		next_start = task_source.next_start()
		self.__sources[task_source] = next_start
		self.__update(task_source)