MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / write_node_file

Function write_node_file

crates/hyperqueue/src/worker/start/program.rs:253–268  ·  view source on GitHub ↗
(ctx: &TaskBuildContext, path: &Path, short_names: bool)

Source from the content-addressed store, hash-verified

251}
252
253fn write_node_file(ctx: &TaskBuildContext, path: &Path, short_names: bool) -> std::io::Result<()> {
254 let file = File::create(path)?;
255 let mut file = BufWriter::new(file);
256 for worker_id in ctx.node_list() {
257 let hostname = ctx.worker_hostname(*worker_id).unwrap();
258 let node_name = if short_names && !is_ip_address(hostname) {
259 hostname.split_once('.').map(|x| x.0).unwrap_or(hostname)
260 } else {
261 hostname
262 };
263 file.write_all(node_name.as_bytes())?;
264 file.write_all(b"\n")?;
265 }
266 file.flush()?;
267 Ok(())
268}
269
270fn insert_resources_into_env(ctx: &TaskBuildContext, program: &mut ProgramDefinition) {
271 let (resource_map, resource_rq_map) = ctx.get_resource_maps();

Callers 1

build_program_taskFunction · 0.85

Calls 4

is_ip_addressFunction · 0.85
node_listMethod · 0.80
worker_hostnameMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected