Skip to content

Streaming setting from Python API + no more relative paths (in non simple cases) - #1145

Open
spirali wants to merge 2 commits into
mainfrom
py-stream
Open

spirali wants to merge 2 commits into
mainfrom
py-stream

Conversation

@spirali

@spirali spirali commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Fixes #668

Comment thread crates/pyhq/python/hyperqueue/job.py Outdated
self.default_workdir = Path(default_workdir).resolve() if default_workdir is not None else default_workdir
self.default_env = default_env or {}
self.name = name
self.stream = Path(stream).resolve() if stream is not None else None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should the paths be resolved on the client? It could be relative to the worker directory, maybe?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Then we should probably not resolve also default_workdir

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, maybe. There is a difference, because the workdir is applied before the worker starts, while the stream is then evaluated relative to the workdir, I assume? But yeah, even for the workdir, the relative path between the client and the server might be different. I think that normalizing the workdir based on the client is kinda intuitive though.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

As I see in the code, the stream path is resolved against woker cwd (that is probably accidental rather than designed).

In the case of share file system, you want stream path pointing to some globally accessed dir so you do not have to manually copy files for postprocessing. Contrary workdir should be on a local filesystem or even ramdisk.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

After some time thinking about it.
I am leaning to resolving stream path as a kind of global path different from worker dir.
Maybe we should do the resolve even after --stream (it is not done today).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We resolve various paths kinda ad-hoc. Maybe we could forbid relative paths, and use % placeholders for specifying explicit relative path roots :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is good idea as the current state is slightly chaotic. I will look at it if there is some potential problem with this change.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What now? I have forbid relative paths (if they do no start with an abspath producing % subsitution) from Python, TOML and CLI if --array is used. For better basic compatibility, plain (no array) CLI submit still accepts relative paths and they are resolved as usual.

@spirali spirali changed the title Streaming setting from Python API Streaming setting from Python API + no more relative paths (in non simple cases) Oct 21, 2026

This branch has not been deployed

No deployments
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.

I/O streaming in Python API

2 participants