Skip to content
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

Ability to write to a pipe from memray.Tracker #574

Closed
1 task done
jhance opened this issue Mar 28, 2024 · 2 comments
Closed
1 task done

Ability to write to a pipe from memray.Tracker #574

jhance opened this issue Mar 28, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@jhance
Copy link

jhance commented Mar 28, 2024

Is there an existing proposal for this?

  • I have searched the existing proposals

Is your feature request related to a problem?

I want to write to a fifo instead of a file but memray complains if the file I point it to already exists. The end problem I am trying to solve is that I want to stream the result to a distributed file system instead of place it on the disk.

Describe the solution you'd like

I'd like to write to a pre-existing fifo pipe.

Alternatives you considered

If memray could just give me the bytes in an iterator that would be fine too.

@jhance jhance added the enhancement New feature or request label Mar 28, 2024
@godlygeek
Copy link
Contributor

As things stand today, this isn't simple. Memray expects to be able to mmap the output file, and pipes cannot be mmapped.

We do support binding to a TCP port, waiting for a client to connect, and then writing the captured data over that socket - https://bloomberg.github.io/memray/api.html#memray.SocketDestination

That's intended for use by the memray live TUI, but you might be able to use that for your needs by spawning a thread or process that connects to that TCP port and writes everything it receives to your FIFO.

@sarahmonod
Copy link
Contributor

After talking about it a bit, we decided we would address this in two separate ways:

  1. Add documentation for writing a wrapper script that smuggles the capture file out: Explain how to run memray and send file over the network for containers #598
  2. Add a way for the Tracker API to take a callback for user post-processing: Add callback to the Tracker API to post-process the capture file #599

Closing this in favor of the other two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants