question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing ObjectID as a function argument in local_mode is broken

See original GitHub issue

System information

  • OS Platform and Distribution: Ubuntu 18.04
  • Ray installed from (source or binary): binary
  • Ray version: 0.8.0.dev6
  • Python version: 3.7
  • Exact command to reproduce: see below

Describe the problem

The argument passing behavior with local_mode=True vs False seems to be different. When I run the code snippet below:

ray.init(local_mode=True)  # Replace with False to get a working example

@ray.remote
def remote_function(x):
    obj = x['a']
    return ray.get(obj)


a = ray.put(42)
d = {'a': a}
result = remote_function.remote(d)
print(ray.get(result))

With local_mode=False I get output 42, as expected. With local_mode=True I get the following error:

Traceback (most recent call last):
  File "/home/alex/all/projects/doom-neurobot/playground/ray_local_mode_bug.py", line 13, in <module>
    print(ray.get(result))
  File "/home/alex/miniconda3/envs/doom-rl/lib/python3.7/site-packages/ray/worker.py", line 2194, in get
    raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(KeyError): /home/alex/miniconda3/envs/doom-rl/bin/python /home/alex/all/projects/doom-neurobot/playground/ray_local_mode_bug.py (pid=2449, ip=10.136.109.38)
  File "/home/alex/miniconda3/envs/doom-rl/lib/python3.7/site-packages/ray/local_mode_manager.py", line 55, in execute
    results = function(*copy.deepcopy(args))
  File "/home/alex/all/projects/doom-neurobot/playground/ray_local_mode_bug.py", line 7, in remote_function
    return ray.get(obj)
  File "/home/alex/miniconda3/envs/doom-rl/lib/python3.7/site-packages/ray/local_mode_manager.py", line 105, in get_objects
    raise KeyError("Value for {} not found".format(object_id))
KeyError: 'Value for LocalModeObjectID(89f92e430883458c8107c10ed53eb35b26099831) not found'

It looks like the LocalObjectID instance inside d loses it’s field value when it gets deep copied during the “remote” function call (currently it’s local_mode_manager.py:55). It’s hard to tell why exactly that happens, looks like a bug.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
richardliawcommented, Nov 8, 2019

Related to #5853? cc @edoakes

0reactions
edoakescommented, Nov 15, 2019

@alex-petrenko this should be fixed the PR above, can you test it out with the latest wheels once they’ve built?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mongoose ObjectID not working as parameter in a function?
I am trying to pass a Mongoose ObjectID to a function in an onclick() This is my code (shortened for ease of reading):...
Read more >
[ray] passing object ID to remote function in local_mode: docs ...
When the function actually gets executed, the argument will be a retrieved as a regular Python object. So if I pass an object...
Read more >
What is ObjectId in MongoDB - GeeksforGeeks
ObjectId.toString(): This method returns ObjectId in String format in javascript representation. 1.Creating ObjectId: To generate new ObjectId ...
Read more >
EN / ACH580 HVAC control program firmware manual - ABB
The manual applies to the ACH580 HVAC control program (version 2.12). To check the firmware version of the control program in use, see...
Read more >
ABAP RAP / FUNCTIONS: Defaulting fields during new object ...
Declare a static function “DefaultForCreate” (scope of this blog post) with returning parameter as $self. Explanation: We are declaring the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found