-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Strange interaction with astropy.coordinates.Angle #76
Comments
I would be surprised of something in Perhaps a good first step would be to check the |
Thanks, @jacobtomlinson. I added the line: print('sys.exec', sys.executable) to the worker function. Using both
which is the conda env I'd expect to be called |
Your example code works perfectly for me, with astropy = 4.3.1, dask_mpi = 2.21.0, dask = 2021.08.0, Python = 3.8.10 and Ubuntu 20.04.2 LTS. I get both the degrees and hour strings out as expected. I will note that the line numbers for the errors do not correspond to the version of astropy that I have installed. |
Thanks, @ste616. The same is true for me as well, actually. The MCVE also runs fine for me, which is part of my confusion. There might be some conflict between that and my full working script, but for the life of me I can't see what it is. |
EDIT: I've also found that the above problem (with u.hourangle) persists even when the function is not delayed (but still using dask-mpi) As an update, it looks like the issue extends to other parts of from distributed import Client
from dask_mpi import initialize
from dask import delayed
from astropy.coordinates import Angle
import astropy.units as u
import time
import numpy as np
@delayed
def worker(freq):
freq_arr = freq.to(u.Hz).value
return freq_arr
def main():
initialize(interface='ipogif0')
client = Client()
results = []
for i in range(100):
freq = np.arange(100) * u.Hz
results.append(
worker(freq)
)
futures = client.persist(results)
outputs = [f.compute() for f in futures]
print('outputs is',outputs)
if __name__ == "__main__":
main() Raises I can workaround this by doing the unit conversion in from distributed import Client
from dask_mpi import initialize
from dask import delayed
from astropy.coordinates import Angle
import astropy.units as u
import time
import numpy as np
@delayed
def worker(freq):
freq_arr = freq
return freq_arr
def main():
initialize(interface='ipogif0')
client = Client()
results = []
for i in range(100):
freq = np.arange(100) * u.Hz
results.append(
worker(freq.to(u.Hz).value)
)
futures = client.persist(results)
outputs = [f.compute() for f in futures]
print('outputs is',outputs)
if __name__ == "__main__":
main() The full traceback is: Traceback...
EDIT 2: If I don't delay the function with the coordinate/hourangle issue, the same error occurs if I use |
The inconsistency is strange. Are you definitely using |
I'm pretty sure that's the case. I'm using a locally installed conda environment. As a test I added: print("I'm in the {func} function!",'dask.__version__', dask.__version__)
print("I'm in the {func} function!",'dask.__file__', dask.__file__) And I get:
|
And |
Here's a test with
As small aside, I noticed I had an inconsistency in my module importing -- i.e.
vs
I corrected to just use the former option, but the issue persists. |
The latter is preferred, but either will mostly be fine.
Without a reproducer, I'm afraid this will be hard for us to track down. |
What happened:
This may be an issue in astropy, so my apologies if this is in the wrong location. Although, this appears to only happen using
dask-mpi
.I'm using
dask-mpi
to distribute a task with using aastropy.coordinates.Angle
object. When I try to convert to theastropy.units.hourangle
format, I get the following error:What you expected to happen:
Using a
LocalCluster
and aSLURMcluster
I do not get this error using otherwise identical code. Further,astropy.coordinate.Angle
explicitly has anhour
property (L161):Further, if I do (see MCVE):
I get
True
! Something strange seems to be happening when I try to access the propety itself. I'll note something similar happened withcoordinates.SkyCoord
and it'shms
property.Minimal Complete Verifiable Example:
This is as close to a minimal setup as my working script. Very frustratingly, the MCVE does not produce the same error. Hair pulling abounds.
Anything else we need to know?:
Environment:
The text was updated successfully, but these errors were encountered: