Delete arbitrary runtime event writer
This commit is contained in:
parent
d66baa276c
commit
058751fb32
3 changed files with 1 additions and 129 deletions
|
|
@ -8,13 +8,11 @@ use epiphany_core::EpiphanyRuntimeJob;
|
|||
use epiphany_core::EpiphanyRuntimeJobResult;
|
||||
use epiphany_core::EpiphanyRuntimeRoleWorkerResult;
|
||||
use epiphany_core::EpiphanyRuntimeSession;
|
||||
use epiphany_core::RuntimeSpineEventOptions;
|
||||
use epiphany_core::RuntimeSpineInitOptions;
|
||||
use epiphany_core::RuntimeSpineJobOptions;
|
||||
use epiphany_core::RuntimeSpineJobResultOptions;
|
||||
use epiphany_core::RuntimeSpineSessionClosureOptions;
|
||||
use epiphany_core::RuntimeSpineSessionOptions;
|
||||
use epiphany_core::append_runtime_event;
|
||||
use epiphany_core::close_runtime_session;
|
||||
use epiphany_core::complete_runtime_job;
|
||||
use epiphany_core::create_runtime_job;
|
||||
|
|
@ -271,30 +269,6 @@ fn main() -> Result<()> {
|
|||
println!("runtime root session repaired");
|
||||
println!("session: {}", session.session_id);
|
||||
}
|
||||
Command::RecordEvent {
|
||||
event_id,
|
||||
event_type,
|
||||
source,
|
||||
session_id,
|
||||
job_id,
|
||||
summary,
|
||||
} => {
|
||||
let event = append_runtime_event(
|
||||
&args.store,
|
||||
RuntimeSpineEventOptions {
|
||||
event_id,
|
||||
occurred_at: now(),
|
||||
event_type,
|
||||
source,
|
||||
session_id,
|
||||
job_id,
|
||||
summary,
|
||||
},
|
||||
)?;
|
||||
println!("runtime event recorded");
|
||||
println!("event: {}", event.event_id);
|
||||
println!("type: {}", event.event_type);
|
||||
}
|
||||
Command::OpenJob {
|
||||
job_id,
|
||||
session_id,
|
||||
|
|
@ -396,14 +370,6 @@ enum Command {
|
|||
RepairRootSession {
|
||||
reason: String,
|
||||
},
|
||||
RecordEvent {
|
||||
event_id: String,
|
||||
event_type: String,
|
||||
source: String,
|
||||
session_id: Option<String>,
|
||||
job_id: Option<String>,
|
||||
summary: String,
|
||||
},
|
||||
OpenJob {
|
||||
job_id: String,
|
||||
session_id: String,
|
||||
|
|
@ -505,52 +471,6 @@ fn parse_command(mut args: Vec<String>) -> Result<Command> {
|
|||
coordinator_note,
|
||||
})
|
||||
}
|
||||
"record-event" => {
|
||||
let mut event_id = format!("event-{}", Uuid::new_v4());
|
||||
let mut event_type = String::new();
|
||||
let mut source = "operator".to_string();
|
||||
let mut session_id = None;
|
||||
let mut job_id = None;
|
||||
let mut summary = String::new();
|
||||
parse_options(args, |name, value| match name {
|
||||
"--event-id" => {
|
||||
event_id = value;
|
||||
Ok(())
|
||||
}
|
||||
"--type" => {
|
||||
event_type = value;
|
||||
Ok(())
|
||||
}
|
||||
"--source" => {
|
||||
source = value;
|
||||
Ok(())
|
||||
}
|
||||
"--session-id" => {
|
||||
session_id = Some(value);
|
||||
Ok(())
|
||||
}
|
||||
"--job-id" => {
|
||||
job_id = Some(value);
|
||||
Ok(())
|
||||
}
|
||||
"--summary" => {
|
||||
summary = value;
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(anyhow!("unknown record-event argument: {name}")),
|
||||
})?;
|
||||
if event_type.trim().is_empty() {
|
||||
return Err(anyhow!("record-event requires --type"));
|
||||
}
|
||||
Ok(Command::RecordEvent {
|
||||
event_id,
|
||||
event_type,
|
||||
source,
|
||||
session_id,
|
||||
job_id,
|
||||
summary,
|
||||
})
|
||||
}
|
||||
"open-job" => {
|
||||
let mut job_id = format!("job-{}", Uuid::new_v4());
|
||||
let mut session_id = String::new();
|
||||
|
|
@ -761,7 +681,7 @@ fn now() -> String {
|
|||
}
|
||||
|
||||
fn usage() -> &'static str {
|
||||
"usage: epiphany-runtime-spine [--store path] <init|status|list-jobs|list-sessions|list-model-requests|list-events|list-coordinator-runs|list-repo-model-proposals|open-session|close-session|repair-root-session|open-job|complete-job|record-event|hello-frame|schema-catalog>"
|
||||
"usage: epiphany-runtime-spine [--store path] <init|status|list-jobs|list-sessions|list-model-requests|list-events|list-coordinator-runs|list-repo-model-proposals|open-session|close-session|repair-root-session|open-job|complete-job|hello-frame|schema-catalog>"
|
||||
}
|
||||
|
||||
fn model_input_item_chars(item: &EpiphanyModelInputItem) -> usize {
|
||||
|
|
|
|||
|
|
@ -434,7 +434,6 @@ pub use runtime_spine::RepoFrontierResearchLifecycle;
|
|||
pub use runtime_spine::RepoFrontierResearchLifecycleStage;
|
||||
pub use runtime_spine::RepoFrontierVerdictModelingLaunchAuthority;
|
||||
pub use runtime_spine::RuntimeHandsReceiptChainSummary;
|
||||
pub use runtime_spine::RuntimeSpineEventOptions;
|
||||
pub use runtime_spine::RuntimeSpineHeartbeatJobOptions;
|
||||
pub use runtime_spine::RuntimeSpineInitOptions;
|
||||
pub use runtime_spine::RuntimeSpineJobOptions;
|
||||
|
|
@ -444,7 +443,6 @@ pub use runtime_spine::RuntimeSpineSessionOptions;
|
|||
pub use runtime_spine::RuntimeTypedFulfillmentEvidence;
|
||||
pub use runtime_spine::abandon_unactivated_runtime_worker_process;
|
||||
pub use runtime_spine::activate_runtime_worker_process;
|
||||
pub use runtime_spine::append_runtime_event;
|
||||
pub use runtime_spine::archive_completed_coordinator_session;
|
||||
pub use runtime_spine::archive_completed_model_session;
|
||||
pub use runtime_spine::archive_failed_runtime_worker_attempt;
|
||||
|
|
|
|||
|
|
@ -967,17 +967,6 @@ pub struct ModelPassFailureTerminalOptions {
|
|||
pub failed_at: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct RuntimeSpineEventOptions {
|
||||
pub event_id: String,
|
||||
pub occurred_at: String,
|
||||
pub event_type: String,
|
||||
pub source: String,
|
||||
pub session_id: Option<String>,
|
||||
pub job_id: Option<String>,
|
||||
pub summary: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct RuntimeSpineJobOptions {
|
||||
pub job_id: String,
|
||||
|
|
@ -12584,41 +12573,6 @@ pub fn complete_runtime_job(
|
|||
Ok(result)
|
||||
}
|
||||
|
||||
pub fn append_runtime_event(
|
||||
store_path: impl AsRef<Path>,
|
||||
options: RuntimeSpineEventOptions,
|
||||
) -> Result<EpiphanyRuntimeEvent> {
|
||||
validate_non_empty(&options.event_id, "event id")?;
|
||||
validate_non_empty(&options.occurred_at, "occurred at")?;
|
||||
validate_non_empty(&options.event_type, "event type")?;
|
||||
validate_non_empty(&options.source, "source")?;
|
||||
let mut cache = runtime_spine_cache(store_path.as_ref())?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
require_identity(&cache)?;
|
||||
if cache
|
||||
.get::<EpiphanyRuntimeEvent>(&options.event_id)?
|
||||
.is_some()
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"runtime event {:?} already exists",
|
||||
options.event_id
|
||||
));
|
||||
}
|
||||
let event = EpiphanyRuntimeEvent {
|
||||
schema_version: RUNTIME_SPINE_SCHEMA_VERSION.to_string(),
|
||||
event_id: options.event_id.clone(),
|
||||
occurred_at: options.occurred_at,
|
||||
event_type: options.event_type,
|
||||
source: options.source,
|
||||
session_id: options.session_id,
|
||||
job_id: options.job_id,
|
||||
summary: options.summary,
|
||||
metadata: BTreeMap::new(),
|
||||
};
|
||||
cache.put(&options.event_id, &event)?;
|
||||
Ok(event)
|
||||
}
|
||||
|
||||
pub fn runtime_spine_status(store_path: impl AsRef<Path>) -> Result<EpiphanyRuntimeSpineStatus> {
|
||||
let store_path = store_path.as_ref();
|
||||
if !store_path.exists() {
|
||||
|
|
|
|||
Reference in a new issue