Expand description
A thin YTsaurus client: enough of the HTTP API v4 to run a Rust worker without a Python installation.
It is deliberately small. It does what launching a job needs — create a
node, upload the worker, write and read tables, start an operation and wait
for it — and nothing else. For everything beyond that, the yt CLI remains
the right tool.
§Launching a job
use ytsaurus_client::{Client, MapSpec};
let client = Client::from_env()?;
// Upload the worker, marked executable so the node can run it.
client.upload_worker("target/.../my_job", "//tmp/my_job")?;
let spec = MapSpec::new("./my_job", ["//tmp/input"], ["//tmp/output"])
.with_local_file("//tmp/my_job")
.with_memory_limit(512 * 1024 * 1024);
let id = client.start_map(&spec)?;
client.wait_for_operation(&id)?;§Configuration
Client::from_env reads YT_PROXY for the cluster address and YT_TOKEN
for the token, matching the yt CLI. A bare host is assumed to be HTTPS; a
local cluster is reached as http://localhost:8000.
§What this does not do
Heavy commands are documented to require asking /hosts for a dedicated
proxy, and this client does not: it sends everything to the address it was
given. That is correct for a local cluster and for any deployment behind a
balancer, but on a large installation an upload may be refused with 503. See
Client::heavy_proxy for the escape hatch.
Re-exports§
pub use crate::error::ClientError;pub use crate::error::Result;
Modules§
- error
- Errors. Errors the client can fail with.
- yson_
build - Constructors for YSON documents, for specs this crate does not model. Small constructors for the YSON documents the API expects.
Structs§
- Client
- A connection to one YTsaurus cluster.
- MapReduce
Spec - A map-reduce operation.
- MapSpec
- A map operation.
Enums§
- Operation
Type - The kind of operation to start.