Sleep
This commit is contained in:
@ -256,6 +256,7 @@ pub enum NodeInstruction {
|
||||
Path,
|
||||
ReadPath,
|
||||
SaveString,
|
||||
Sleep,
|
||||
|
||||
// create basic data types
|
||||
Symbol,
|
||||
@ -483,6 +484,7 @@ impl NodeInstruction {
|
||||
("display node", DisplayNode),
|
||||
("display edge", DisplayEdge),
|
||||
],
|
||||
| Self::Sleep => vec![("seconds", PositiveInt)],
|
||||
}
|
||||
.into_iter()
|
||||
.map(|e| (e.0.to_string(), e.1))
|
||||
@ -577,6 +579,7 @@ impl NodeInstruction {
|
||||
| Self::PositiveBisimilarityPaigeTarjanNoLabels =>
|
||||
vec![("out", String)],
|
||||
| Self::PositiveBisimilarityPaigeTarjan => vec![("out", String)],
|
||||
| Self::Sleep => vec![("out", PositiveInt)],
|
||||
};
|
||||
res.into_iter()
|
||||
.map(|res| (res.0.to_string(), res.1))
|
||||
@ -1061,6 +1064,7 @@ impl NodeTemplateTrait for NodeInstruction {
|
||||
"Positive Paige & Torjan (ignore labels)",
|
||||
| Self::PositiveBisimilarityPaigeTarjan =>
|
||||
"Positive Paige & Torjan",
|
||||
| Self::Sleep => "Sleep",
|
||||
})
|
||||
}
|
||||
|
||||
@ -1142,6 +1146,7 @@ impl NodeTemplateTrait for NodeInstruction {
|
||||
| Self::PositiveBisimilarityPaigeTarjanNoLabels
|
||||
| Self::PositiveBisimilarityPaigeTarjan =>
|
||||
vec!["Positive Graph", "Positive Bisimilarity"],
|
||||
| Self::Sleep => vec!["General"],
|
||||
}
|
||||
}
|
||||
|
||||
@ -1246,6 +1251,7 @@ impl NodeTemplateIter for AllInstructions {
|
||||
NodeInstruction::PositiveBisimilarityKanellakisSmolka,
|
||||
NodeInstruction::PositiveBisimilarityPaigeTarjanNoLabels,
|
||||
NodeInstruction::PositiveBisimilarityPaigeTarjan,
|
||||
NodeInstruction::Sleep,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,11 +109,12 @@ fn generate_to_evaluate(
|
||||
continue;
|
||||
}
|
||||
|
||||
let first_output = if let Some(o) = graph[n_id].output_ids().next() {
|
||||
o
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
let first_output =
|
||||
if let Some(o) = graph[n_id].output_ids().next() {
|
||||
o
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
let hashes =
|
||||
if let Some(hashes) = outputs_cache.input_hashes(&first_output) {
|
||||
hashes
|
||||
@ -2469,6 +2470,22 @@ fn process_template(
|
||||
},
|
||||
}
|
||||
},
|
||||
| NodeInstruction::Sleep => {
|
||||
let input_seconds = retrieve_from_cache![1];
|
||||
let hash_inputs = hash_inputs!(input_seconds);
|
||||
|
||||
if let BasicValue::PositiveInt { value } = input_seconds {
|
||||
std::thread::sleep(std::time::Duration::from_secs(value as u64));
|
||||
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
input_seconds,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not an integer");
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user