Sleep
This commit is contained in:
@ -256,6 +256,7 @@ pub enum NodeInstruction {
|
|||||||
Path,
|
Path,
|
||||||
ReadPath,
|
ReadPath,
|
||||||
SaveString,
|
SaveString,
|
||||||
|
Sleep,
|
||||||
|
|
||||||
// create basic data types
|
// create basic data types
|
||||||
Symbol,
|
Symbol,
|
||||||
@ -483,6 +484,7 @@ impl NodeInstruction {
|
|||||||
("display node", DisplayNode),
|
("display node", DisplayNode),
|
||||||
("display edge", DisplayEdge),
|
("display edge", DisplayEdge),
|
||||||
],
|
],
|
||||||
|
| Self::Sleep => vec![("seconds", PositiveInt)],
|
||||||
}
|
}
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|e| (e.0.to_string(), e.1))
|
.map(|e| (e.0.to_string(), e.1))
|
||||||
@ -577,6 +579,7 @@ impl NodeInstruction {
|
|||||||
| Self::PositiveBisimilarityPaigeTarjanNoLabels =>
|
| Self::PositiveBisimilarityPaigeTarjanNoLabels =>
|
||||||
vec![("out", String)],
|
vec![("out", String)],
|
||||||
| Self::PositiveBisimilarityPaigeTarjan => vec![("out", String)],
|
| Self::PositiveBisimilarityPaigeTarjan => vec![("out", String)],
|
||||||
|
| Self::Sleep => vec![("out", PositiveInt)],
|
||||||
};
|
};
|
||||||
res.into_iter()
|
res.into_iter()
|
||||||
.map(|res| (res.0.to_string(), res.1))
|
.map(|res| (res.0.to_string(), res.1))
|
||||||
@ -1061,6 +1064,7 @@ impl NodeTemplateTrait for NodeInstruction {
|
|||||||
"Positive Paige & Torjan (ignore labels)",
|
"Positive Paige & Torjan (ignore labels)",
|
||||||
| Self::PositiveBisimilarityPaigeTarjan =>
|
| Self::PositiveBisimilarityPaigeTarjan =>
|
||||||
"Positive Paige & Torjan",
|
"Positive Paige & Torjan",
|
||||||
|
| Self::Sleep => "Sleep",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1142,6 +1146,7 @@ impl NodeTemplateTrait for NodeInstruction {
|
|||||||
| Self::PositiveBisimilarityPaigeTarjanNoLabels
|
| Self::PositiveBisimilarityPaigeTarjanNoLabels
|
||||||
| Self::PositiveBisimilarityPaigeTarjan =>
|
| Self::PositiveBisimilarityPaigeTarjan =>
|
||||||
vec!["Positive Graph", "Positive Bisimilarity"],
|
vec!["Positive Graph", "Positive Bisimilarity"],
|
||||||
|
| Self::Sleep => vec!["General"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1246,6 +1251,7 @@ impl NodeTemplateIter for AllInstructions {
|
|||||||
NodeInstruction::PositiveBisimilarityKanellakisSmolka,
|
NodeInstruction::PositiveBisimilarityKanellakisSmolka,
|
||||||
NodeInstruction::PositiveBisimilarityPaigeTarjanNoLabels,
|
NodeInstruction::PositiveBisimilarityPaigeTarjanNoLabels,
|
||||||
NodeInstruction::PositiveBisimilarityPaigeTarjan,
|
NodeInstruction::PositiveBisimilarityPaigeTarjan,
|
||||||
|
NodeInstruction::Sleep,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,7 +109,8 @@ fn generate_to_evaluate(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let first_output = if let Some(o) = graph[n_id].output_ids().next() {
|
let first_output =
|
||||||
|
if let Some(o) = graph[n_id].output_ids().next() {
|
||||||
o
|
o
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
@ -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)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user