A technical deep-dive into how process models are structured. This is optional context that is not required for using the process model visual interface.
Process models in HASH are built on a single agent, and there are three elements to their definition:
behaviors
array — just like any agent in HASH, you'll be filling this with a mix of published behaviors from the Process Modeling Library and custom behaviors you've written.process_labels
array — this allows you to add descriptive labels to each process, and link them to their parameters.Each process block behavior operates in three parts:
The only exception to this is the Sink block. Since it represents the end of a process, it does not send objects into a new queue.
The behaviors
array of an agent running a process model must start with the @hash/age/age.rs
behavior, and can then contain a mix of custom and published behaviors.
This behavior provides the agent with a field that allows the other process behaviors to run. Without it the other Process Library behaviors will throw errors.
init.json
{
"behaviors": [
"@hash/age/age.rs"
// more process behaviors such as source, delay, etc...
],
"...": "..."
}
The agent must also contain an array of labels for each process behavior. The labels allow you to give a descriptive name to each block. Only the behaviors listed on the following Process Behaviors page require a label; all other published or custom behaviors should have a ""
placeholder string.
init.json
{
"behaviors": [
"@hash/age/age.rs",
"@hash/process/source.js",
"@hash/process/delay.js",
"@hash/process/sink.js"
],
"process_labels": ["", "start_process", "perform_action", "end_process"],
"...": "..."
}
Certain blocks need to access resources
to perform their functions. Resources can represent any quantifiable thing required to complete a task, for instance: staff, workstations, and wrenches. Resources should be represented on the process agents state as a field, with a number value representing how many are currently available. For example:
{
"...": "...",
"staff": 10,
"workstations": 3,
"wrenches": 5
}
The parameters for each block must be specified in the agent's fields. Each parameter is keyed according to the label in the process_labels
array. For example:
start_process
"start_process"
{
"behaviors": [
"@hash/age/age.rs",
"@hash/process/source.js",
"@hash/process/delay.js",
"@hash/process/delay.js",
"@hash/process/sink.js"
],
"process_labels": [
"",
"start_process",
"perform_action",
"verify_action",
"end_process"
],
"process_parameters": {
"start_process": {
// parameters for the Source block
},
"perform_action": {
// parameters for the first Delay block
},
"verify_action": {
// parameters for the second Delay block
},
"end_process": {
// parameters for the Sink block
}
},
"...": "..."
}
On the next page you can learn more about the parameters needed for each type of block, and their specific functions.
Previous
Next