hundreds-breakfast-49010
01/22/2021, 12:08 AMEngineAware.artifacts supposed to return a dict of `Digest`s or Union[Snapshot, Digest], or some other type?hundreds-breakfast-49010
01/22/2021, 12:09 AMhundreds-breakfast-49010
01/22/2021, 12:10 AMDigest type worked to support thathundreds-father-404
01/22/2021, 12:11 AMFileDigest vs. Digest (directory digest)hundreds-breakfast-49010
01/22/2021, 12:17 AMEngineAwareReturnType.artifactshundreds-breakfast-49010
01/22/2021, 12:17 AMEnriched* workunit)hundreds-breakfast-49010
01/22/2021, 12:18 AMhundreds-breakfast-49010
01/22/2021, 12:19 AMhundreds-breakfast-49010
01/22/2021, 12:19 AMpub stdout: Option<hashing::Digest>,
pub stderr: Option<hashing::Digest>,hundreds-breakfast-49010
01/22/2021, 12:19 AMWorkunitMetadatahundreds-breakfast-49010
01/22/2021, 12:20 AMhundreds-father-404
01/22/2021, 12:20 AMright now we handle putting the stdout/stderr output on the workunit for the process execution (which doesn't get created if that process execution is cached, hence the problem)Ah ha. So we need to stop caring about the
Process workunit, and care purely about the enriched_foo workunithundreds-father-404
01/22/2021, 12:21 AMmessage() that gets printed to the console, right? For example, via artifacts
Asking because we add some of our own message to what gets printed, e.g. a check or minus signhundreds-breakfast-49010
01/22/2021, 12:23 AMhundreds-breakfast-49010
01/22/2021, 12:23 AMhundreds-father-404
01/22/2021, 12:24 AMSnapshot always refers to the file system. Are you trying to add something to represent the stdout/stderr? If so, I think you'd want a FileDigest, which is referring to a strhundreds-breakfast-49010
01/22/2021, 12:24 AMworkunit_to_py_value that does:
if let Some(stdout_digest) = &workunit.metadata.stdout.as_ref() {
artifact_entries.push((
externs::store_utf8("stdout_digest"),
crate::nodes::Snapshot::store_file_digest(core, stdout_digest),
));
}
if let Some(stderr_digest) = &workunit.metadata.stderr.as_ref() {
artifact_entries.push((
externs::store_utf8("stderr_digest"),
crate::nodes::Snapshot::store_file_digest(core, stderr_digest),
));
}hundreds-breakfast-49010
01/22/2021, 12:24 AMValue on the workunit that has Python type Snapshothundreds-breakfast-49010
01/22/2021, 12:25 AMDigest, I'm not surehundreds-father-404
01/22/2021, 12:26 AMFileDigest object. The Snapshot is confusing - that is purely for namespacing of the methodhundreds-father-404
01/22/2021, 12:26 AMpub fn store_file_digest(core: &Arc<Core>, item: &hashing::Digest) -> Value {
externs::unsafe_call(
core.types.file_digest,
&[
externs::store_utf8(&item.0.to_hex()),
externs::store_i64(item.1 as i64),
],
)
}hundreds-father-404
01/22/2021, 12:26 AMcore.types.file_digesthundreds-breakfast-49010
01/22/2021, 12:26 AMFileDigesthundreds-breakfast-49010
01/22/2021, 12:26 AMUnion[Snapshot, FileDigest]hundreds-breakfast-49010
01/22/2021, 12:27 AMhundreds-breakfast-49010
01/22/2021, 12:27 AMhundreds-breakfast-49010
01/22/2021, 12:27 AMSnapshot::store_file_digest for handling stdout/stderr in this exact casehundreds-breakfast-49010
01/22/2021, 12:28 AMEngineAwareReturnType.artifacts fromhundreds-breakfast-49010
01/22/2021, 12:29 AMdef artifacts(self) -> Optional[Dict[str, Snapshot]]: to
def artifacts(self) -> Optional[Dict[str, Union[Snapshot, FileDigest]]]:hundreds-breakfast-49010
01/22/2021, 12:29 AMhundreds-father-404
01/22/2021, 12:29 AMso I think this implies that the right type schema for artifacts is Union[Snapshot, FileDigest]Yep. Although, I'm not sure we should still use
Snapshot. It could be Digest.
At the time, there was no FileDigest so it was ambiguous what was meant by Digest, hence us wanting to use the unambiguous Snapshot to refer to the file systemhundreds-father-404
01/22/2021, 12:30 AMUnion[Digest, FileDigest]?
Snapshot may be more ergonomic for consumers, I'm not sure how it gets consumedhundreds-breakfast-49010
01/22/2021, 12:33 AMhundreds-breakfast-49010
01/22/2021, 12:34 AMDigestshundreds-breakfast-49010
01/22/2021, 12:34 AMhundreds-father-404
01/22/2021, 12:37 AMhundreds-breakfast-49010
01/22/2021, 12:37 AMhundreds-breakfast-49010
01/22/2021, 3:27 AMartifacts or even just passing non-Snapshot values in that method regardless of the type annotations breaks things at the engine level in a way that I spent way too long trying to untangle