Skip to content

Instantly share code, notes, and snippets.

@simon-mo
Created November 26, 2020 00:36
Show Gist options
  • Select an option

  • Save simon-mo/3f120f7f53b82d5a62e200778d54665d to your computer and use it in GitHub Desktop.

Select an option

Save simon-mo/3f120f7f53b82d5a62e200778d54665d to your computer and use it in GitHub Desktop.
this_node_key = next(
filter(
lambda resource_key: resource_key.startswith("node:"),
next(
filter(
lambda node: (
node["NodeID"] == ray.get_runtime_context().node_id.hex()
),
ray.nodes(),
)
)["Resources"].keys(),
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment