Skip to content

Log profiling information from worker. - #178

Merged
pcmoritz merged 5 commits into
ray-project:masterfrom
robertnishihara:eventlog
Jan 6, 2017
Merged

pcmoritz merged 5 commits into
ray-project:masterfrom
robertnishihara:eventlog

Conversation

@robertnishihara

@robertnishihara robertnishihara commented Jan 5, 2017 •

Copy link
Copy Markdown
Collaborator

Note: this slows down the simple benchmark below by about 40us.

@ray.remote
def f(x):
  return x

%timeit ray.get(f.remote(3))

I think about 5 or so microseconds come just from the additional IPC to photon to log the events (though that call isn't on the critical path, so it's not clear why it slows it down with multiple workers (but it does). The remaining slowdown comes from all of the logging calls.

For example, a simple logging call like the following takes around 4us, and we do that around 8 times per task, which seems to explain the remaining slowdown.

def g():
  with ray.log_span("event_type1"):
    pass

%timeit g()

We'll need to redo the logging code to address this.

Comment thread lib/python/ray/worker.py

Args:
event_type (str): The type of the event.
contents: More general data to store with the event.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's demand here that content is a little more restricted, say dicts with only strings as keys and vals, to make it trivially json serializable

Comment thread lib/python/ray/worker.py Outdated

def flush_log(worker=global_worker):
"""Send the logged worker events to the global state store."""
worker_id_hex = repr(worker.worker_id)[9:-1]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs fixing

Comment thread src/photon/photon_scheduler.c Outdated
offset += payload_length;
CHECK(offset == length);
if (state->db != NULL) {
ray_log_event(state->db, key_name, key_name_length, payload,

@pcmoritz pcmoritz Jan 5, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe print a warning if not connected here? (together with the message so it will not get lost)

Comment thread src/photon/photon_client.c Outdated
int64_t key_name_length,
uint8_t *payload,
int64_t payload_length) {
int64_t message_length = sizeof(key_name_length) + sizeof(payload_length) +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's put a TODO here that this should be flatbufferized (then we can also pass the flatbuffers through from python directly)

Comment thread src/photon/photon_scheduler.c Outdated
case TASK_DONE: {
} break;
case EVENT_LOG_MESSAGE: {
/* Parse the message. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's put a flatbuffers todo here too

@pcmoritz
pcmoritz merged commit 651aa60 into ray-project:master Jan 6, 2017
@pcmoritz
pcmoritz deleted the eventlog branch January 6, 2017 00:47
dstrodtman added a commit that referenced this pull request Oct 13, 2026
## Description

Bumps `sphinxcontrib-openapi`, which renders the [Ray Jobs REST API
specification](https://docs.ray.io/en/master/cluster/running-applications/job-submission/api.html)
page, from 0.9.0 to
[0.10.0](https://pypi.org/project/sphinxcontrib-openapi/0.10.0/), and
regenerates the docs deplock.

0.10.0 fixes five upstream bugs, two of which this page's source comment
named as blockers for request and response examples:

-
[sphinx-contrib/openapi#166](sphinx-contrib/openapi#166):
`:generate-examples-from-schemas:` crashed on an `allOf` that targets a
non-object schema, which is how `JobDetails` attaches descriptions to
the `JobType` and `JobStatus` enums.
-
[sphinx-contrib/openapi#165](sphinx-contrib/openapi#165):
`:response-examples-for:` and the other whitespace-delimited options
were rejected as unknown options.
- [#173](sphinx-contrib/openapi#173),
[#171](sphinx-contrib/openapi#171), and
[#178](sphinx-contrib/openapi#178): an
operation summary written as a YAML block scalar rendered literal `**`,
the old renderer's request body block was left unclosed, and the 3.0
renderer crashed on a non-object request body.

Examples still can't be enabled. With `:generate-examples-from-schemas:`
on 0.10.0, the stop endpoint's 200 response, a bare `JobStatus` enum,
renders as `PENDING` rather than `"PENDING"` under `Content-Type:
application/json`. The `http` lexer rejects it, and the warning fails
the build. That's
[sphinx-contrib/openapi#172](sphinx-contrib/openapi#172),
fixed for the `httpdomain` renderer on the open
[sphinx-contrib/openapi#185](sphinx-contrib/openapi#185).
This PR updates the source comment in `api.md` to name that bug instead
of the two that are now fixed. The rendered page doesn't change.

What changes:

- `doc/requirements-doc.txt`: `sphinxcontrib-openapi==0.9.0` → `0.10.0`.
- `python/deplocks/docs/docbuild_depset_py3.11.lock`: regenerated with
raydepsets. The diff is the one package block. 0.10.0 declares the same
dependencies as 0.9.0, so there's no transitive churn.
- `doc/source/cluster/running-applications/job-submission/api.md`:
source comment only.

0.10.0 raises `requires-python` from `>=3.10` to `>=3.11`. The only
consumer is the docbuild depset, which is Python 3.11 on both Read the
Docs and the `docbuild-py3.11` CI image.

## Related issues

Related to sphinx-contrib/openapi#172.

## Additional information

**Not a duplicate.** No open PR touches `sphinxcontrib-openapi` or bumps
this pin, and no open Dependabot PR targets `doc/requirements-doc.txt`.

**Tests run:**

- `bazelisk run //ci/raydepsets:raydepsets -- build
ci/raydepsets/configs/docs.depsets.yaml --name docbuild_depset_311`
regenerated the lock.
- `bazelisk run //ci/raydepsets:raydepsets -- build
ci/raydepsets/configs/docs.depsets.yaml --check` passed for all three
docs depsets. The doctest lock is unchanged.
- `make -C doc rtd-build` in a Python 3.11 venv installed from
`doc/requirements-doc.lock.txt`: `build succeeded.`, zero Sphinx
warnings under `-W`. The `rtd-doctor` preflight confirmed the
environment matches Read the Docs. The rendered Jobs API page has all 8
endpoints, including `/stop`.
- The Jobs spec rendered standalone with `openapi_default_renderer =
"httpdomain"` under `-W`: clean on 0.10.0 with no example options. With
`:generate-examples-from-schemas:` it fails on the unquoted `PENDING`,
which is the bug the updated comment describes.

AI assistance (Claude Code) was used to prepare this change. I reviewed
every changed line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants