Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SoS is broken on Python 3.12? #1542

Closed
gaow opened this issue Apr 9, 2024 · 6 comments
Closed

SoS is broken on Python 3.12? #1542

gaow opened this issue Apr 9, 2024 · 6 comments
Labels

Comments

@gaow
Copy link
Member

gaow commented Apr 9, 2024

On Python 3.10 and SoS 0.25.0 this workflow:

[1]
parameter: dat = path
input: dat
print(_input)

it works well.

sos run test.sos --dat test.sos
INFO: Running 1:
test.sos
INFO: 1 is completed.
INFO: Workflow default (ID=wadc76383948ec2d8) is executed successfully with 1 completed step.

But on Python 3.12, it fails:

# sos run test.sos --dat test.sos
INFO: Running 1: 
ERROR: [1]: [1]: Failed to process input statement dat
: file_target object has no attribute traced

I have another workflow that shows a different error:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/.pixi/envs/sos/lib/python3.12/site-packages/sos/targets.py", line 128, in __getattr__
    return self._dict[name]
           ^^^^^^^^^^
  File "/root/.pixi/envs/sos/lib/python3.12/site-packages/sos/targets.py", line 132, in __getattr__
    raise AttributeError(f"{self.__class__.__name__} object has no attribute {name}") from e
AttributeError: file_target object has no attribute _dict

after we upgrade from Python 3.10 to 3.12 it seems we are crippled ..

@gaow gaow added the bug label Apr 9, 2024
@BoPeng
Copy link
Contributor

BoPeng commented Apr 9, 2024

I can reproduce the problem with a Python 3.12 environment, but cannot figure out what went wrong immediately.

I have updated the test suite to add python 3.12 to catch all such problems.

@BoPeng BoPeng mentioned this issue Apr 9, 2024
@BoPeng
Copy link
Contributor

BoPeng commented Apr 10, 2024

ok, find the source of the problem. What we did was sending a compiled global statement in task file to be executed on remote host. However, the docker side uses python 3.10, and the test side uses 3.9, and a change in the ast package has changed the format of the ast object....

$ ssh -q root@localhost -p 32768 "bash --login -c '  sos execute t5ee683a10ef0f203 -v 4 -s force -m run'"
INFO: t5ee683a10ef0f203 started
  File "/usr/local/lib/python3.10/site-packages/sos/__main__.py", line 2831, in main
    args.func(args, workflow_args)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/sos/__main__.py", line 2831, in main
    args.func(args, workflow_args)
  File "/usr/local/lib/python3.10/site-packages/sos/__main__.py", line 1521, in cmd_execute
    exit_code.append(executor.execute(task))
  File "/usr/local/lib/python3.10/site-packages/sos/task_executor.py", line 95, in execute
    res = self.execute_single_task(task_id, params, runtime, sig_content)
  File "/usr/local/lib/python3.10/site-packages/sos/task_executor.py", line 146, in execute_single_task
    prepare_env(global_def[0], global_def[1])
  File "/usr/local/lib/python3.10/site-packages/sos/executor_utils.py", line 210, in prepare_env
    exec(compile(gdef, filename="<ast>", mode="exec"), env.sos_dict._dict)
TypeError: required field "lineno" missing from alias

So the problem happens if local and remote sos has different versions of python, which we can fix, or ignore.

@gaow
Copy link
Member Author

gaow commented Apr 10, 2024

Ahh .... I think it is enough to check and report error or warning for that case, leaving it for users to fix. That should be fair enough.

@BoPeng
Copy link
Contributor

BoPeng commented Apr 11, 2024

sos 0.25.1 is released for this fix.

@BoPeng BoPeng closed this as completed Apr 11, 2024
@gaow
Copy link
Member Author

gaow commented Apr 11, 2024

great thanks @BoPeng , i take that conda release is automatic and will be there in a few hours? Sorry i cannot remember if it is automatic or you have to click on some extra buttons. I'll merge the PR once I see it pass on conda-forge GitHub.

@BoPeng
Copy link
Contributor

BoPeng commented Apr 11, 2024

automatic, merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants