cooperative-computing-lab / cctools

The Cooperative Computing Tools (cctools) enable large scale distributed computations to harness hundreds to thousands of machines from clusters, clouds, and grids.
http://ccl.cse.nd.edu
Other
134 stars 116 forks source link

wq python: _python_function_command may use incorrect python executable #2951

Closed btovar closed 2 years ago

btovar commented 2 years ago

When using PythonTask, we wrap the function calls with:

 command = 'python {wrapper} {function} {args} {out}'.format(...

That python executable comes from the $PATH, and may be a different executable version from the one running the wq manager. If both manger and task have the same environment (say from the same conda tarball), this not an issue. This issue appeared in tests with centos7, where a wq manager runs with python3, but the tasks wrappers use python, which is a python2.

dthain commented 2 years ago

Advice from Python seems not to help... https://peps.python.org/pep-0394/

dthain commented 2 years ago

It seems like we have two different ways to address this:

btovar commented 2 years ago

Ensuring the appropriate environment would be an opportunity to use poncho. However, it takes minutes to build an environment and I don't know if we want to slow the tests for that.

If we use python3, then we would need to disable PythonTask for python2. But I'm fine with that, as any application still using python2 is not using the newer PythonTask.

We could append the 2 or 3 to the python command when constructing the wrapper. (We do something like that for the poncho spec in topcoffea). That would work also for python4. I'm inclining to do this option.

dthain commented 2 years ago

Oh, I see, this command line is constructed by Python code, right? Why not just sense the python version on the manager side, and use that to construct the right command line?