Skip to content

Commit

Permalink
ProgressReporter.report_progress signature was changed
Browse files Browse the repository at this point in the history
  • Loading branch information
okolo committed Nov 7, 2023
1 parent 6af4ebe commit bf1aa52
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions oda_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,21 +1357,23 @@ def __init__(self):
def enabled(self):
return self._callback is not None

Check warning on line 1358 in oda_api/api.py

View check run for this annotation

Codecov / codecov/patch

oda_api/api.py#L1358

Added line #L1358 was not covered by tests

def report_progress(self, message: str):
def report_progress(self, stage: str=None, progress: int=50, substage: str=None, subprogress: int=None, message:str=None):
"""
Report progress via callback URL
:param stage: current stage description string
:param stage: current stage progress in %
:param stage: current substage description string
:param stage: current substage progress in %
:param message: message to pass
"""
callback_payload = {k: str(v) for k, v in locals().items() if v is not None and k != 'self'}

Check warning on line 1369 in oda_api/api.py

View check run for this annotation

Codecov / codecov/patch

oda_api/api.py#L1369

Added line #L1369 was not covered by tests

if not self.enabled:
logger.info('no callback registered, skipping')
return

Check warning on line 1373 in oda_api/api.py

View check run for this annotation

Codecov / codecov/patch

oda_api/api.py#L1371-L1373

Added lines #L1371 - L1373 were not covered by tests

logger.info('will perform callback: %s', self._callback)

Check warning on line 1375 in oda_api/api.py

View check run for this annotation

Codecov / codecov/patch

oda_api/api.py#L1375

Added line #L1375 was not covered by tests

callback_payload = dict(
message=message
)

if re.match('^file://', self._callback):
with open(self._callback.replace('file://', ''), "w") as f:
json.dump(callback_payload, f)
Expand Down

0 comments on commit bf1aa52

Please sign in to comment.