Skip to content

Commit

Permalink
fix test better
Browse files Browse the repository at this point in the history
Signed-off-by: Paul S. Schweigert <[email protected]>
  • Loading branch information
psschwei committed Sep 25, 2024
1 parent 19f19e2 commit baf5226
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions gateway/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ def build_env_variables(token, job: Job, args: str = None) -> Dict[str, str]:
env variables dict
"""
extra = {}
arguments = "{}"
# only set arguments if size is <1MB
if args and sys.getsizeof(args) < 1000000:
arguments = args
arguments = "{}"
if args:
if sys.getsizeof(args) < 1000000:
arguments = args
else:
logger.warn("arguments for job [%s] are > 1MB and will not be written to env var", job.id)

if settings.SETTINGS_AUTH_MECHANISM != "default":
extra = {
Expand Down
1 change: 1 addition & 0 deletions gateway/tests/api/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_build_env_for_job(self):
"ENV_JOB_GATEWAY_TOKEN": "42",
"ENV_JOB_GATEWAY_HOST": "http://localhost:8000",
"ENV_JOB_ID_GATEWAY": "42",
"ENV_JOB_ARGUMENTS": "{}",
},
)

Expand Down

0 comments on commit baf5226

Please sign in to comment.