aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

`aiida/common/progress_reporter.py` could accept `**kwargs`

Open khsrali opened this issue 1 year ago • 0 comments

This is particularly useful, when unit and unit_scale is to be set during a callback. see: https://github.com/aiidateam/disk-objectstore/pull/171 & https://github.com/aiidateam/aiida-core/pull/6562

An ideal use case would be:

# in aiida-core
with get_progress_reporter()(total=1) as progress:
  callback = create_callback(progress)
  external_function(.., callback=callback)

# some other package
def external_function(.., callback=callback):
  ..
  callback(
      action="init",
      value={
          "total": 10,
          "description": "my_description",
          "unit": 'B'          #**kwargs
          "unit_scale": 1024   #**kwargs
      },
  )

khsrali avatar Sep 18 '24 12:09 khsrali