Skip to content

fix(slurm): import logger in the function task connector - #3481

Open
pcbeingused333 wants to merge 1 commit into
flyteorg:masterfrom
pcbeingused333:fix/slurm-function-connector-logger
Open

pcbeingused333 wants to merge 1 commit into
flyteorg:masterfrom
pcbeingused333:fix/slurm-function-connector-logger

Conversation

@pcbeingused333

Copy link
Copy Markdown

SlurmFunctionConnector.get() (plugins/flytekit-slurm/flytekitplugins/slurm/function/connector.py) calls logger.info(...) after reading the job's stdout, and logger.debug(...) when the stdout file is missing, but the module never imports logger. Every poll of a Slurm function task therefore raised NameError: name 'logger' is not defined right after the job state was read. The script connector in the same plugin already does from flytekit.loggers import logger.

The fix is that one import.

Test: tests/test_slurm_fn_connector.py runs get() against a mocked SSH/SFTP connection, once with the stdout file present and once with SFTPNoSuchFile. Both fail with the NameError on main and pass with the import.

Disclosure: this change was prepared with the help of an AI coding assistant (Claude Code) and submitted by the account owner.

SlurmFunctionConnector.get() calls logger.info/debug but never imports it, so polling any Slurm function task raised NameError after reading the job state. Import the flytekit logger like the script connector does and cover get() with a test.

Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant