Skip to content

Commit

Permalink
avoid warning to be issued multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
kalessin committed Apr 17, 2024
1 parent 0567303 commit 271ee7c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions shub_workflow/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,19 @@ def resolve_project_id(project_id=None) -> Optional[int]:
wait=wait_fixed(DASH_RETRY_WAIT_SECS),
)

_settings_warning_issued = False


def kumo_settings():
global _settings_warning_issued
settings = {}
shub_job_data = json.loads(os.environ.get("SHUB_SETTINGS", "{}"))
if shub_job_data:
settings.update(shub_job_data["project_settings"])
settings.update(shub_job_data["spider_settings"])
else:
logger.info("Couldn't find Dash project settings, probably not running in Dash")
elif not _settings_warning_issued:
logger.warning("Couldn't find Dash project settings, probably not running in Dash")
_settings_warning_issued = True
return settings


Expand Down

0 comments on commit 271ee7c

Please sign in to comment.