Model, Job, Result, and Snapshot Lifecycles
"Model", "snapshot" and "job" in NexusFlow are not different names for the same data. The workspace provides currently available definitions, and the browser maintains editable drafts. The platform generates snapshots when saving the model and creating jobs. Calculation results and running snapshots have their own storage and retention rules.
After understanding these boundaries, developers can correctly answer the following questions: whether an operation is modifying the current page, switching the current version of the model, or creating new computing resources; where to restore it when reopening; after a certain data expires, which associated objects still exist.
This page only describes resource relationships and state transitions. See Resource Identifiers for resource identification, Authentication and Permissions for access judgment, and Model and Snapshot APIs and Job, Control, and Result APIs for specific requests and responses.
Life Cycle Overview
The solid lines in the figure represent the main create or read relationships, and the dotted lines represent reference relationships. Model records, model snapshots, job snapshots, job records and running snapshots all have their own identifiers; even if the contents of two snapshots are the same, their identifiers cannot be interchanged. See Resource Identifiers for detailed rules.
What Are the Various Types of Resources Saved?
| Resources | Main Content | Is It Variable? | Source of Facts |
|---|---|---|---|
| workspace definition | Currently available components, ports, parameters, verification rules and computing capabilities | Administrators can update | workspace configuration in the platform |
| current draft | sheet, component instances, topology, parameters and global parameters in the current tab | Editable, may not have been saved yet | Current browser page |
| Model record | Name, description, visibility, workspace type, creator, and reference to the current model snapshot | Metadata and current snapshot references can be updated | Platform business storage |
| Model snapshot | The graph, component instance parameters and global parameters when saving the model once | Do not modify after creation | Platform snapshot storage |
| Job snapshot | The graph, parameters and component definition used in this calculation when starting the job | Do not modify after creation | Platform snapshot storage; the current browser also saves a copy |
| simulation job | Creator, workspace, associated model, job snapshot, status, progress, time and run ID, etc. | The status and progress change with the operation, and the job snapshot reference remains unchanged. | Platform job record |
| server result stream | Messages generated in sequence such as status, logs, curves, tables, monitoring, etc. | Continuously appended during operation, expires according to independent policy | Platform result storage |
| Browser local job cache | Basic job information, job snapshot copy, received messages and partial result viewing configuration | Can be appended and cleared, no automatic synchronization across browsers | Current browser website storage |
| Run snapshot | The internal state and metadata output by the simulation kernel at a certain running time | If the data is not edited after it is generated, it will become available, fail or expire. | Platform running snapshot storage |
Model snapshots and job snapshots can be carried by the same snapshot resource, but the semantics are determined by the referrer: the current snapshot recorded by the model is used for editing again, and the snapshot recorded by the job is used to restore a fixed calculation input. Don't treat the two as the same resource simply based on their similar JSON structure.
How the Workspace Definition Affects Models and Jobs
The workspace definition is the current version of the modeling rule and is not part of a model. When a user enters Simulation Workbench, the page loads the current definitions, which are then used to interpret component types, ports, and parameters in the model draft.
Effects on Current Drafts and Model Snapshots
Model snapshots save component instances and parameter values, but do not completely archive all component definitions in the form of job snapshots. Therefore, when reopening a saved model, the platform combines:
- The model record currently points to the model snapshot;
- Corresponds to the current definition of workspace.
If definitions change for compatibility, old models may need to be normalized or migrated when reopened. Saving the migrated draft generates a new model snapshot and moves the current snapshot pointer, but does not overwrite the old snapshot.
Impact on Job Snapshots
When starting a job, the platform writes the current draft and the component definition actually used this time into the job snapshot. After updating the workspace definition, the created job snapshot will not be reversely overwritten. Historical jobs should be interpreted as defined when they were created, and their inputs cannot be re-extrapolated using current definitions.
This is why compatibility testing needs to cover both "reopen old model" and "reopen old job": the former will use the current definition, and the latter will use the definition frozen when the job was created.
What Do Create, Save and Save as Change?
Create or Edit a Draft
Create a new blank model, import local files, modify topology or parameters, first only change the current draft. At this point there may be no model records, nor any server model snapshots.
The parameters in the draft have taken effect, which does not mean that the model has been saved. Before refreshing, closing, or being overwritten by other content, the caller should decide whether to prompt the user based on the unsaved status of the page; browser memory cannot be used as evidence of successful persistence.
First Save
The first save creates a model record and creates a model snapshot of the current model contents. The model record's current snapshot reference points to this new snapshot. It does not create simulation jobs, result streams, or running snapshots.
Save Existing Model
When saving the model content, the platform creates a new immutable model snapshot, and then switches the current snapshot reference recorded in the model to the new snapshot. Old snapshots will not be updated in place.
If only the model metadata such as name, description or visibility is modified this time, but the graph and parameter content do not change, the platform can only update the model record without creating a new model snapshot. Therefore, "model update time change" cannot be used to infer that the snapshot identifies a certain change.
Saving an existing model will not change:
- Jobs that have been created by the model and their job snapshots;
- Already have job status, result stream and local cache;
- A running snapshot has been generated.
Save As
Saving as creates a new model record and model snapshot based on the current draft, and then switches the current page to the new model. The original model record, the current snapshot of the original model, and the content of the original model remain unchanged.
Existing jobs will not be copied to the new model, nor will their ownership change. The current tab no longer displays the job list of the original model, which does not mean that these jobs or their browser local data have been deleted.
What Happens When You Start a Job
Each time a job is started, a new job record and a new job snapshot are created. The job snapshot is taken from the current draft at the moment of launch, rather than simply referencing the current model snapshot of the model record. Therefore:
- Unsaved draft modifications can be entered into new jobs;
- Starting the job will not save the model incidentally, nor will it move the current snapshot pointer of the model;
- Even if the content of the draft is exactly the same as the current model snapshot, the job snapshot is still an independent resource;
- Starting again will get another job and another job snapshot, not overwriting the previous job.
When creating a job, the server saves the job record and job snapshot, and the current browser also establishes a local job cache. The cache saves a copy of the job snapshot and appends result messages that have been received during the run. The success of creation on one side should not be inferred by the client based solely on the local status of the other side; after the creation request times out, it should be queried by the job ID before deciding whether to retry.
After a job is created, its snapshot is no longer modified. When the user adjusts view configurations such as charts, data blocks, or legends in the read-only job view, the browser's local cache may be changed, but the server job snapshot will not be overwritten, nor will the model be written back.
How Result Streaming and Local Caching Work Together
The status, logs and results generated by the simulation kernel first enter the server result stream, and are then consumed by the browser or SDK in order. The browser only caches messages it actually receives, so the number of local messages may be less than the number of messages the server ever produced.
Three states need to be distinguished at the same time:
- Job Status: Whether the job is waiting, running, suspended or ended.
- Results Available Status: Whether the server result stream is still readable.
- Snapshot Availability Status: Whether the job snapshot still exists and whether the read-only job view can be rebuilt.
The three do not derive from each other. The job may have ended successfully, but the result stream has expired; the job record may still exist, but the job snapshot has been cleared; the local cache may also retain some results, but cannot continue to be supplemented from the server.
Clients should treat the server job record as the source of truth for job identity and state, the server result stream as the source of truth for remote results, and the local cache as an accelerated and restored copy of the current browser. See Job, Control, and Result APIs for specific conventions on result reading, disconnection resuming and expired response.
How to Generate and Reuse Running Snapshots
A running snapshot is not a model snapshot, nor is it an archive of job results. It comes from the simulation kernel in a certain job and saves the internal state of the calculation program.
Running snapshots can be generated on demand during the allowed running phase of the job, or at the normal end as configured by the job. The generation process has independent state; only data that is available and has not expired and that the current caller has access to can be used as startup state.
When starting from a running snapshot, the platform will still create a new job snapshot and a new job based on Current Draft. The new job also uses:
- Topology, component parameters and global parameters in the current draft;
- Kernel startup status in the selected running snapshot.
It does not continue the original job, reuse the original job ID, or change the source job back to running. Deleting or expiring a running snapshot will only make the startup state unusable. It will not delete the source job, source job snapshot, model or result stream.
Where to Restore from When Reopening
Reopen the Model
The platform reads the model snapshot currently pointed to by the model record, and then combines it with the current definition of the workspace to create a new current draft. Unsaved drafts are not model records and cannot be assumed to persist after changing devices or reopening them.
The same browser may also discover a previously saved cache of local jobs by model identifier and restore compatible jobs to the job list. This is a local restore, not a model snapshot containing jobs.
Open a Job from the Job List
The platform reads job records and job snapshots based on the job ID, and re-establishes the local cache in the current browser. If the server result stream is still available, the client can continue reading uncached messages.
Opening a job only creates a read-only job view. It will not switch the current snapshot of the model record, nor will the job input be automatically saved as a new model. When the job snapshot content is overwritten to the main canvas, only the current draft is changed; model resources will not be updated or created until explicitly saved later.
Change Browser or Device
The browser's local cache will not be synchronized with the account. New devices must rely on server job records and job snapshots to rebuild the job view; local custom names and view configurations that only existed in older browsers may not be restored. All reads still need to pass the permission check of the current account again, see Authentication and Permissions for details.
Cleanup and Expiration of Independent Boundaries
Don’t wrap up all cleanups with one “delete” action. The current resource cleaning relationship is as follows:
| Action or Event | What Will Change | Nothing Will Automatically Change |
|---|---|---|
| Delete model | Set the model record to deleted status so that it is no longer listed as a normal model | Existing jobs, job results, or running snapshots will not be deleted. |
| Delete job card | Try to stop the unfinished job first, and then delete the job cache and list items in the current browser. | Server job records or server job snapshots are not deleted |
| Clean unloaded jobs from local storage | Delete the corresponding cache in the current browser | Server jobs will not be stopped and server resources will not be deleted. |
| Result flow expires | Clean up result messages on the server so that missing results cannot be reissued | The final status of the job will not be changed; job records or job snapshots will not be deleted; messages that have been written locally may still exist. |
| Old snapshots are cleaned regularly | Delete server snapshots that have expired and are no longer current for any model; jobs that reference the snapshot will dereference it | Keep records of jobs; snapshots that remain as the current version of the model are not included in this cleanup |
| Running snapshot expires | Delete running state data and mark snapshot as expired | Source jobs, models, job snapshots, or result streams are not deleted |
| Delete running snapshot | Delete the running snapshot records and data | Will not delete the source job or new jobs that have been created based on it |
The specific retention period belongs to the deployment configuration and should not be hard-coded in the client business logic. The client should handle it based on the "available, expired or non-existent" returned by the interface, rather than making its own judgment based on the creation time alone.
Key Invariant
When implementing functionality related to models, jobs, or results, the following invariants should be maintained:
- The current draft is the only editable modeling state. Model snapshots and job snapshots are not modified in place.
- Model records only point to a current model snapshot. Saving content creates a new snapshot and moves the pointer. Metadata updates do not necessarily create a snapshot.
- Start Jobs Based on the Current Draft. It does not require the draft to be saved first, nor does it save the model for the user.
- Each Job Fixes Its Own Job Snapshot. It cannot be overwritten by subsequent model saves, workspace definition updates, or recalculations.
- The same content of Model snapshot and job snapshot identifiers are not interchangeable. does not mean that the resource identity, permissions or retention rules are the same.
- The existence of either Job records, job snapshots, and result streams determine availability respectively. does not prove that the other two are still available.
- Browser local cache is not a cross-device source of truth. It can be incomplete, sanitized, or unrecoverable due to version incompatibility.
- Running a snapshot can only help create new jobs. It does not restore the original job, nor does it replace the model, job snapshot, or results data.
- Permissions Are Revalidated on Each Visit. has created or cached resources before, which does not mean that the current account still has the right to read server data.
- Cleanup Only Works on Clear Targets. Unless the interface documentation explicitly states otherwise, do not assume that deleting a model will delete the job, or that deleting the local cache will delete the server record.
Development Checklist
Before committing changes that involve resource lifecycle, verify at least:
- New, first save, save and save as respectively produced the expected model record and snapshot relationships;
- Jobs started without saving a draft contain exactly the contents of the draft, while the current snapshot of the model remains unchanged;
- After modifying and saving the model, the old job will still be opened and calculated according to the original job snapshot;
- After the workspace definition is updated, the old model and old jobs will take the correct interpretation path respectively;
- The same job has clear behavior when the local cache exists, the cache does not exist, the result expires, and the job snapshot is cleared;
- New jobs are generated after starting from the running snapshot, and the source job and running snapshot have not been accidentally overwritten;
- The delete or cleanup operation did not cross its resource boundaries;
- All reads and writes are verified against resource ownership and caller permissions, rather than relying on front-end buttons or cache state.
When you need to map these relationships to specific fields and requests, continue reading Model and Snapshot APIs , Job, Control, and Result APIs , and Status and Error Reference .