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

'os' has no attribute 'sched_getaffinity' #8

Closed
eljeffeg opened this issue Apr 24, 2020 · 2 comments · Fixed by #9
Closed

'os' has no attribute 'sched_getaffinity' #8

eljeffeg opened this issue Apr 24, 2020 · 2 comments · Fixed by #9

Comments

@eljeffeg
Copy link
Contributor

It would be nice if in the manager.py there was an exception value for threads as os.sched_getaffinity is not available on all nix systems. I'm running macOS for example and this fails. If I set it to a static value, it runs fine.

  File "/Users/Jeff/Documents/workspace/katana/env/bin/katana", line 11, in <module>
    load_entry_point('katana==2.0', 'console_scripts', 'katana')()
  File "/Users/Jeff/Documents/workspace/katana/env/lib/python3.7/site-packages/katana-2.0-py3.7.egg/katana/__main__.py", line 36, in main
    manager = Manager(monitor=monitor, config_path=args.config)
  File "/Users/Jeff/Documents/workspace/katana/env/lib/python3.7/site-packages/katana-2.0-py3.7.egg/katana/manager.py", line 70, in __init__
    "threads": len(os.sched_getaffinity(0)),
AttributeError: module 'os' has no attribute 'sched_getaffinity'
@calebstewart
Copy link
Collaborator

I added a try/except for the default. I'd prefer sched_getaffinity as it properly reports if the process is restricted in some way. The branch will fallback to using multiprocessing.cpu_count() if it isn't available, though. To my understanding, multiprocessing.cpu_count should be available everywhere.

Please let me know if that doesn't fix the issue. I was going to check back before closing the issue, but github closed it automatically because I said "should fix #8" in my commit message, haha.

@calebstewart calebstewart reopened this Apr 24, 2020
@calebstewart
Copy link
Collaborator

Since I didn't hear back, I'm going to close this issue, as the problem appears to be fixed from my end.

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 a pull request may close this issue.

2 participants