-
Notifications
You must be signed in to change notification settings - Fork 0
Database
^ Convention ^ Description ^
| ''nimrod_*'' | All Nimrod Tables. |
| ''nimrod_resource_*'' | Tables used for resources and their related properties. |
=== Stored Procedures ===
^ Convention ^ Description ^
| ''_*'' | Helper procedure. |
| ''_acr_*'' | Helpers for ''add_compiled_run()''. |
| ''_msg_*'' | Helpers for messaging functionality. |
| ''_msg_build_*'' | Message payload helpers. |
| ''_msg_t_*'' | Message trigger procedure. |
| ''resolve_*'' | Resolve the entity via its path. |
| ''_res_*'' | Resource helpers. |
| ''_res_t_*'' | Resource trigger procedure. |
| ''_exp_t_*'' | Experiment trigger procedure. |
| ''_gt_*'' | Helpers for ''export_task()''. |
^ Convention ^ Description ^
| ''t_*'' | Trigger |
| ''t_exp_*'' | Experiment trigger |
| ''t_msg_*'' | Message trigger |
| ''t_res_*'' | Resource trigger |
-
nimrod_full_jobs- Same as thenimrod_jobstable except with three additional columns containing:-
status, the derived job status. -
var_names, an array of the variable names. -
var_values, an array of the variable values.
-
-
nimrod_full_runs- Same as thenimrod_runstable except with two additional columns,vars_jsonandtasks_json, containing a JSON array of the variable names (without implicit variables), and a JSON blob (export_tasks) of the tasks respectively. -
nimrod_resource_storage_root- Same as thenimrod_resource_storagetable except it only contains root resources (parent IS NULL) and contains the additional columns:-
type_name,type_class,amqp_uri,amqp_cert_path,amqp_no_verify_peer,amqp_no_verify_host
-
-
nimrod_mapped_agents- A combination of thenimrod_agent_definitionsandnimrod_agent_posix_mappingstables.
Database Stored Procedure reference. Most of these map directly to the NimrodAPI, and thus are undocumented.
Insert/Update configuration. Any field set to NULL will use the old value.
Only the row with id = 1 is updated. It is created if it doesn't exist.
FUNCTION update_config(_work_dir TEXT, _amqp_uri nimrod_uri, _amqp_routing_key TEXT, _tx_uri nimrod_uri) RETURNS nimrod_config;Get the global configuration. This will throw if setup hasn't been run.
FUNCTION get_config() RETURNS nimrod_config;Get a property. Returns NULL if it doesn't exist.
FUNCTION get_property(_key nimrod_config_key) RETURNS TEXT;Set a property. If _value is NULL or empty, delete it.
FUNCTION set_property(_key nimrod_config_key, _value TEXT) RETURNS TEXT;FUNCTION get_properties() RETURNS SETOF nimrod_config;Add an experiment and return its row.
FUNCTION add_experiment(_name TEXT, _work_dir TEXT) RETURNS nimrod_experiments;Get an experiment row by either its id or name.
FUNCTION get_experiment(_exp_id BIGINT) RETURNS SETOF nimrod_experiments;
FUNCTION get_experiment(_name TEXT) RETURNS SETOF nimrod_experimentsDelete an experiment by either its id or name.
FUNCTION delete_experiment(_exp_id BIGINT) RETURNS SETOF VOID;
FUNCTION delete_experiment(_name TEXT) RETURNS SETOF VOID;Add a compiled run JSON dump, returning its row.
FUNCTION add_compiled_run(_exp_id BIGINT, _name TEXT, _work_dir TEXT, _file_token TEXT, _run JSONB) RETURNS nimrod_full_runs;- This function is huge, it's in ''ddl-add-compiledrun.sql''.
- Set
_file_tokentoNULLto auto-generate a token.
Lookup a run by its id or name, and the id of its parent experiment.
FUNCTION get_run(_exp_id BIGINT, _run_id BIGINT) RETURNS SETOF nimrod_full_runs;
FUNCTION get_run(_exp_id BIGINT, _name TEXT) RETURNS SETOF nimrod_full_runs;FUNCTION flag_run(_run_id BIGINT, _flag nimrod_run_flag);Get all the runs for an experiment.
FUNCTION get_experiment_runs(_exp_id BIGINT) RETURNS SETOF nimrod_full_runs;Add a batch of jobs to the given run, such for each _values[i], a job
will be added such that vars[j] has the value _values[i][j].
FUNCTION add_multiple_jobs(_run_id BIGINT, _vars TEXT[], _values TEXT[][]) RETURNS SETOF nimrod_full_jobs- Any
NULLvalues will be coalesced to''.
FUNCTION get_job_status(_job_id BIGINT) RETURNS nimrod_job_status;Create a job attempt.
FUNCTION create_job_attempt(_job_id BIGINT, _uuid UUID, _work_dir TEXT, _agent_uuid UUID) RETURNS SETOF nimrod_job_attempts;FUNCTION start_job_attempt(_att_id BIGINT, _agent_uuid UUID) RETURNS SETOF nimrod_job_attempts;FUNCTION finish_job_attempt(_att_id BIGINT, _failed BOOLEAN) RETURNS SETOF nimrod_job_attempts;FUNCTION get_job_attempts(_job_id BIGINT) RETURNS SETOF nimrod_job_attempts;FUNCTION get_job_attempt(_att_id BIGINT) RETURNS SETOF nimrod_job_attempts;FUNCTION filter_jobs(_run_id BIGINT, _status nimrod_job_status[], _start BIGINT, _limit BIGINT) RETURNS SETOF nimrod_full_jobs;FUNCTION get_resource_type_info() RETURNS SETOF nimrod_resource_types;
FUNCTION get_resource_type_info(_type TEXT) RETURNS SETOF nimrod_resource_types;Add a root resource with the given configuration.
This will throw if _typename is not a valid type.
FUNCTION add_root_resource(_name TEXT, _typename TEXT, _config JSONB, _amqp_uri nimrod_uri, _tx_uri nimrod_uri) RETURNS nimrod_resource_storage_root;Add a child resource with the given configuration.
FUNCTION add_child_resource(_name TEXT, _parent BIGINT, _config JSONB, _tx_uri nimrod_uri) RETURNS nimrod_resource_storage;FUNCTION resolve_resource(_parent BIGINT, _path nimrod_path) RETURNS SETOF nimrod_resource_storage;
FUNCTION resolve_resource(_path nimrod_path) RETURNS SETOF nimrod_resource_storage;FUNCTION get_root_resource(_name TEXT) RETURNS SETOF nimrod_resource_storage_root;FUNCTION get_child_resources(_parent BIGINT) RETURNS SETOF nimrod_resource_storage;FUNCTION get_parent_resource(_id BIGINT) RETURNS SETOF nimrod_resource_storage;FUNCTION get_root_resource(_id BIGINT) RETURNS SETOF nimrod_resource_storage_root;FUNCTION walk_resource_to_root(_id BIGINT) RETURNS SETOF nimrod_resource_storage;FUNCTION get_root_resources() RETURNS SETOF nimrod_resource_storage_root;Get the resources assigned to the experiment with id _exp_id.
FUNCTION get_assigned_resources(_exp_id BIGINT) RETURNS SETOF nimrod_resource_storage;- Recall that assignments are stored on the leaves, so this will return said leaves.
Assign the resource with id _res_id to the experiment with id _exp_id, returning the newly-added assignment rows. Existing assignments will not be returned.
FUNCTION assign_resource(_res_id BIGINT, _exp_id BIGINT) RETURNS SETOF nimrod_resource_assignments;Unassign the resource with id _res_id from the experiment with id _exp_id, returning the deleted assignments.
FUNCTION unassign_resource(_res_id BIGINT, _exp_id BIGINT) RETURNS SETOF nimrod_resource_assignments;Get the state of the resource assignment.
Valid values are:
- 0 -- The resource is not assigned.
- 1 -- The resource is partially assigned.
- 2 -- The resource is fully assigned.
FUNCTION get_resource_assignment_state(_res_id BIGINT, _exp_id BIGINT) RETURNS INTEGER;Get the capabilities of a given resource.
Valid values are:
- 0 -- The resource is incapable.
- 1 -- The resource is partially capable.
- 2 -- The resource is fully capable.
FUNCTION get_resource_caps(_res_id BIGINT, _run_id BIGINT) RETURNS INTEGER;Add capabilities to a resource.
FUNCTION add_resource_caps(_res_id BIGINT, _run_id BIGINT) RETURNS VOID;Remove capabilities from a resource.
FUNCTION remove_resource_caps(_res_id BIGINT, _run_id BIGINT) RETURNS VOID;FUNCTION resolve_resource_txuri(_id BIGINT) RETURNS nimrod_uri;FUNCTION resolve_resource_amqpuri(_id BIGINT) RETURNS nimrod_uri;FUNCTION get_agent_information(_uuid UUID) RETURNS SETOF nimrod_resource_agents;FUNCTION get_agent_resource(_uuid UUID) RETURNS SETOF nimrod_resource_storage;FUNCTION get_agents_on_resource(_res_id BIGINT) RETURNS SETOF nimrod_resource_agents;FUNCTION add_agent(_state nimrod_agent_state, _queue TEXT, _uuid UUID, _shutdown_signal INTEGER, _shutdown_reason nimrod_agent_shutdown_reason, _location BIGINT) RETURNS nimrod_resource_agents;FUNCTION update_agent(_uuid UUID, _state nimrod_agent_state, _signal INTEGER, _reason nimrod_agent_shutdown_reason) RETURNS SETOF nimrod_resource_agents;FUNCTION poll_master_messages() RETURNS SETOF nimrod_master_message_storage;FOR INTERNAL USE ONLY
FUNCTION add_master_message(op nimrod_message_operation, class nimrod_master_message_class, payload JSONB);CREATE OR REPLACE FUNCTION add_command_result(
_attempt_id BIGINT,
_status nimrod_command_result_status,
_command_index BIGINT,
_time REAL,
_retval INT,
_message TEXT,
_error_code INT
) RETURNS nimrod_command_results AS $$
INSERT INTO nimrod_command_results(attempt_id, status, command_index, time, retval, message, error_code)
VALUES(_attempt_id, _status, _command_index, _time, _retval, _message, _error_code)
RETURNING *;
$$ LANGUAGE SQL;