docstr: Update information associated with a task.
  
  Args:
      task_id (TaskID): Task id (returned by add_task).
      total (float, optional): Updates task.total if not None.
      completed (float, optional): Updates task.completed if not None.
      advance (float, optional): Add a value to task.completed if not None.
      description (str, optional): Change task description if not None.
      visible (bool, optional): Set visible flag if not None.
      refresh (bool): Force a refresh of progress information. Default is False.
      **fields (Any): Additional data fields required for rendering.
docstr_tok: ["Update","information","associated","with","a","task",".","Args",":","task_id","(","TaskID",")",":","Task","id","(","returned","by","add_task",")",".","total","(","float",",","optional",")",":","Updates","task.total","if","not","None",".","completed","(","float",",","optional",")",":","Updates","task.completed","if","not","None",".","advance","(","float",",","optional",")",":","Add","a","value","to","task.completed","if","not","None",".","description","(","str",",","optional",")",":","Change","task","description","if","not","None",".","visible","(","bool",",","optional",")",":","Set","visible","flag","if","not","None",".","refresh","(","bool",")",":","Force","a","refresh","of","progress","information",".","Default","is","False",".","*","*","fields","(","Any",")",":","Additional","data","fields","required","for","rendering","."]
code: def update(
      self,
      task_id: TaskID,
      *,
      total: Optional[float] = None,
      completed: Optional[float] = None,
      advance: Optional[float] = None,
      description: Optional[str] = None,
      visible: Optional[bool] = None,
      refresh: bool = True,
      **fields: Any,
  ) -> None:
      """Update information associated with a task.
  
      Args:
          task_id (TaskID): Task id (returned by add_task).
          total (float, optional): Updates task.total if not None.
          completed (float, optional): Updates task.completed if not None.
          advance (float, optional): Add a value to task.completed if not None.
          description (str, optional): Change task description if not None.
          visible (bool, optional): Set visible flag if not None.
          refresh (bool): Force a refresh of progress information. Default is False.
          **fields (Any): Additional data fields required for rendering.
      """
      with self._lock:
          task = self._tasks[task_id]
          completed_start = task.completed
  
          if total is not None and total != task.total:
              task.total = total
              task._reset()
          if advance is not None:
              task.completed += advance
          if completed is not None:
              task.completed = completed
          if description is not None:
              task.description = description
          if visible is not None:
              task.visible = visible
          task.fields.update(fields)
          update_completed = task.completed - completed_start
  
          current_time = self.get_time()
          old_sample_time = current_time - self.speed_estimate_period
          _progress = task._progress
  
          popleft = _progress.popleft
          # 这里修改为至少保留一个，防止超长时间的迭代影响判断
          while (
              len(_progress) > 1
              and _progress[0].timestamp < old_sample_time
          ):
              popleft()
          if update_completed > 0:
              _progress.append(
                  ProgressSample(current_time, update_completed)
              )
          if (
              task.completed >= task.total
              and task.finished_time is None
          ):
              task.finished_time = task.elapsed
  
      if refresh:
          self.refresh()
  
imports: import sys
  from typing import Any, Union, Optional
  from rich.progress import Progress, Console, GetTimeCallable, get_console, TaskID, Live, Text, ProgressSample
  from rich.progress import ProgressColumn, TimeRemainingColumn, BarColumn, TimeElapsedColumn, TextColumn
  from fastNLP.envs import get_global_rank
  from .utils import is_notebook
label_desc: Use image node_id 9 for calling the FRichProgress obj's underlying member method code with example usage: obj.update(task_id) without return types