AI / Apache Burr Interview questions
What is Forking State, and when would you use it?
Forking lets a new application start from a specific point in a different, prior application’s history, without adding to or mutating that original run. It is set via three optional arguments to initialize_from: fork_from_app_id, fork_from_partition_key, and fork_from_sequence_id (the exact step to fork from, rather than the latest).
app = ( ApplicationBuilder() ... .initialize_from( persister, resume_at_next_action=True, default_state={}, default_entrypoint="...", fork_from_app_id=prior_app_id, fork_from_sequence_id=some_earlier_step, ) .with_identifiers(app_id=new_app_id) # the fork is stored under its OWN identity .build() )
This is the mechanism behind "what if I had chosen differently" debugging: rewind to step 6 of a bad production run, fork it, and replay from there with a tweak, all without touching the original trace. Because the new application gets its own app_id from with_identifiers(), the original run stays untouched and browsable in the UI.
More Related questions...