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.

[workflows/client] Cannot get Workflows / Client to work!

See original GitHub issue

Search before asking

  • I searched the issues and found no similar issues.

Ray Component

Others

What happened + What you expected to happen

I started two containers with rayproject/ray:1df67e-py36-cpu.

docker run -it -p 10001:10001 rayproject/ray:1df67e-py36-cpu bash
 > ray start --head
 
 docker run -it --net=host rayproject/ray:1df67e-py36-cpu bash
# second container

In the second container, I ran:

from ray import workflow
ray.init("ray://127.0.0.1:10001")
workflow.init()

In [14]: @ray.remote
    ...: def hello():
    ...:     return "hello"
    ...:
    ...: @workflow.step
    ...: def words() -> List[ray.ObjectRef]:
    ...:     return [hello.remote(), ray.put("world")]
    ...:
    ...: @workflow.step
    ...: def concat(words: List[ray.ObjectRef]) -> str:
    ...:     return " ".join([ray.get(w) for w in words])

 my_workflow = concat.step(words.step())
 my_workflow.run()

And I get an exception:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-6ce323455dc3> in <module>
----> 1 my_workflow.run()

~/anaconda3/lib/python3.6/site-packages/ray/workflow/common.py in run(self, workflow_id, metadata)
   444             The running result.
   445         """
--> 446         return ray.get(self.run_async(workflow_id, metadata))
   447
   448     @PublicAPI(stability="beta")

~/anaconda3/lib/python3.6/site-packages/ray/workflow/common.py in run_async(self, workflow_id, metadata)
   486         from ray.workflow.execution import run
   487         self._step_id = None
--> 488         return run(self, workflow_id, metadata)
   489
   490

~/anaconda3/lib/python3.6/site-packages/ray/workflow/execution.py in run(entry_workflow, workflow_id, metadata)
    45         # Workflow ID format: {Entry workflow UUID}.{Unix time to nanoseconds}
    46         workflow_id = f"{str(uuid.uuid4())}.{time.time():.9f}"
---> 47     step_type = entry_workflow.data.step_options.step_type
    48
    49     logger.info(f"Workflow job created. [id=\"{workflow_id}\", storage_url="

~/anaconda3/lib/python3.6/site-packages/ray/workflow/common.py in data(self)
   370         """Get the workflow data."""
   371         if self._data.inputs is None:
--> 372             self._data.inputs = self._prepare_inputs()
   373             del self._prepare_inputs
   374         return self._data

~/anaconda3/lib/python3.6/site-packages/ray/workflow/step_function.py in prepare_inputs()
    48                 ensure_ray_initialized()
    49                 return serialization_context.make_workflow_inputs(
---> 50                     flattened_args)
    51
    52             workflow_data = WorkflowData(

~/anaconda3/lib/python3.6/site-packages/ray/workflow/serialization_context.py in make_workflow_inputs(args_list)
   157     workflows: List[Workflow] = []
   158     workflow_refs: List[WorkflowRef] = []
--> 159     with workflow_args_serialization_context(workflows, workflow_refs):
   160         # NOTE: When calling 'ray.put', we trigger python object
   161         # serialization. Under our serialization context,

~/anaconda3/lib/python3.6/contextlib.py in __enter__(self)
    79     def __enter__(self):
    80         try:
---> 81             return next(self.gen)
    82         except StopIteration:
    83             raise RuntimeError("generator didn't yield") from None

~/anaconda3/lib/python3.6/site-packages/ray/workflow/serialization_context.py in workflow_args_serialization_context(workflows, workflow_refs)
    61         Workflow,
    62         serializer=workflow_serializer,
---> 63         deserializer=_resolve_workflow_outputs)
    64
    65     def workflow_ref_serializer(workflow_ref):

~/anaconda3/lib/python3.6/site-packages/ray/util/serialization.py in register_serializer(cls, serializer, deserializer)
    16             This function itself must be serializable.
    17     """
---> 18     context = ray.worker.global_worker.get_serialization_context()
    19     context._register_cloudpickle_serializer(cls, serializer, deserializer)
    20

~/anaconda3/lib/python3.6/site-packages/ray/worker.py in get_serialization_context(self, job_id)
   216         if job_id is None:
   217             job_id = self.current_job_id
--> 218         with self.lock:
   219             if job_id not in self.serialization_context_map:
   220                 self.serialization_context_map[

AttributeError: 'Worker' object has no attribute 'lock'

Versions / Dependencies

rayproject/ray:1df67e-py36-cpu.

MacOS computer

Reproduction script

See above

Anything else

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
richardliawcommented, Jan 14, 2022

Workaround:

In [9]: @ray.remote
   ...: def execute():
   ...:     workflow.init()
   ...:     my_workflow = concat.step(words.step())
   ...:     return my_workflow.run()
   ...:
   ...:

In [10]: ray.get(execute.remote())
Out[10]: 'hello world'

(execute pid=611) 2022-01-14 00:19:19,008	INFO api.py:52 -- Using storage: file:///tmp/ray/workflow_data
(execute pid=611) 2022-01-14 00:19:19,008	WARNING api.py:65 -- Calling 'workflow.init()' again with the same storage.
(execute pid=611) 2022-01-14 00:19:19,012	INFO execution.py:49 -- Workflow job created. [id="804c66aa-0af7-4bb4-831c-ac64e8ee39b9.1642148359.010978460", storage_url="file:///tmp/ray/workflow_data"]. Type: FUNCTION.
1reaction
vsergeyevcommented, Feb 25, 2022

@iycheng we may confirm, prototype is fixing issue on our side. We use Ray to run scientific quantum computing workflows, and this fix helps us a lot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sso and client mode auth together doesn't work #7490 - GitHub
i tried starting the server with any combo of these: --auth-mode=sso --auth-mode=client --auth-mode=sso,client --auth-mode=sso client all ...
Read more >
Execute a workflow - Google Cloud
You can execute a workflow using the client libraries, in the Google Cloud console, using the Google Cloud CLI, or by sending a...
Read more >
Managing workflows with nodejs - Stack Overflow
I am trying to use nodejs to manage my workflows instead of using the console. The createWorkflow method returns a 200 code but...
Read more >
Argo Server - The workflow engine for Kubernetes
The Argo Server is a server that exposes an API and UI for workflows. You'll need to use this if you want to...
Read more >
Top 5 hubspot3 Code Examples - Snyk
Learn more about how to use hubspot3, based on hubspot3 code examples ... "3" class WorkflowsClient(BaseClient): """ The hubspot3 Workflows client uses 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