Skip to content
Snippets Groups Projects
Commit 3b903ad1 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

Task #8570: added tables resource_allocation.resource_claim_property_type and...

Task #8570: added tables resource_allocation.resource_claim_property_type and resource_allocation.resource_claim_property as replacement for nr_of_parts. Added view resource_allocation.resource_claim_property_view
parent 979817f8
No related branches found
No related tags found
No related merge requests found
...@@ -7,5 +7,6 @@ INSERT INTO resource_allocation.task_status VALUES (200, 'prepared'), (300, 'app ...@@ -7,5 +7,6 @@ INSERT INTO resource_allocation.task_status VALUES (200, 'prepared'), (300, 'app
(1150, 'error'), (1200, 'obsolete'); -- This is the list from OTDB, we'll need to merge it with the list from MoM in the future, might use different indexes? (1150, 'error'), (1200, 'obsolete'); -- This is the list from OTDB, we'll need to merge it with the list from MoM in the future, might use different indexes?
INSERT INTO resource_allocation.task_type VALUES (0, 'observation'),(1, 'pipeline'); -- We'll need more types INSERT INTO resource_allocation.task_type VALUES (0, 'observation'),(1, 'pipeline'); -- We'll need more types
INSERT INTO resource_allocation.resource_claim_status VALUES (0, 'claimed'), (1, 'allocated'), (2, 'conflict'); INSERT INTO resource_allocation.resource_claim_status VALUES (0, 'claimed'), (1, 'allocated'), (2, 'conflict');
INSERT INTO resource_allocation.resource_claim_property_type VALUES (0, 'nr_of_IS_files'),(1, 'nr_of_CS_files'),(2, 'nr_of_UV_files'),(3, 'nr_of_IM_files'),(4, 'nr_of_cores'),(5, 'nr_of_beamlets'),(6, 'nr_of_bits');
INSERT INTO resource_allocation.config VALUES (0, 'max_fill_percentage_cep4', '85.00'), (1, 'claim_timeout', '172800'); -- Just some values 172800 is two days in seconds INSERT INTO resource_allocation.config VALUES (0, 'max_fill_percentage_cep4', '85.00'), (1, 'claim_timeout', '172800'); -- Just some values 172800 is two days in seconds
COMMIT; COMMIT;
...@@ -176,7 +176,6 @@ CREATE TABLE resource_allocation.resource_claim ( ...@@ -176,7 +176,6 @@ CREATE TABLE resource_allocation.resource_claim (
status_id integer NOT NULL REFERENCES resource_allocation.resource_claim_status DEFERRABLE INITIALLY IMMEDIATE, status_id integer NOT NULL REFERENCES resource_allocation.resource_claim_status DEFERRABLE INITIALLY IMMEDIATE,
session_id integer NOT NULL REFERENCES resource_allocation.claim_session DEFERRABLE INITIALLY IMMEDIATE, session_id integer NOT NULL REFERENCES resource_allocation.claim_session DEFERRABLE INITIALLY IMMEDIATE,
claim_size bigint NOT NULL, claim_size bigint NOT NULL,
nr_of_parts int NOT NULL DEFAULT 1,
username text, username text,
user_id integer, user_id integer,
PRIMARY KEY (id) PRIMARY KEY (id)
...@@ -184,6 +183,24 @@ CREATE TABLE resource_allocation.resource_claim ( ...@@ -184,6 +183,24 @@ CREATE TABLE resource_allocation.resource_claim (
ALTER TABLE resource_allocation.resource_claim ALTER TABLE resource_allocation.resource_claim
OWNER TO resourceassignment; OWNER TO resourceassignment;
CREATE TABLE resource_allocation.resource_claim_property_type (
id serial NOT NULL,
name text NOT NULL,
PRIMARY KEY (id)
) WITH (OIDS=FALSE);
ALTER TABLE resource_allocation.resource_claim_property_type
OWNER TO resourceassignment;
CREATE TABLE resource_allocation.resource_claim_property (
id serial NOT NULL,
resource_claim_id integer NOT NULL REFERENCES resource_allocation.resource_claim ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE,
type_id integer NOT NULL REFERENCES resource_allocation.resource_claim_property_type DEFERRABLE INITIALLY IMMEDIATE,
value int NOT NULL DEFAULT 1,
PRIMARY KEY (id)
) WITH (OIDS=FALSE);
ALTER TABLE resource_allocation.resource_claim_property
OWNER TO resourceassignment;
CREATE TABLE resource_monitoring.resource_capacity ( CREATE TABLE resource_monitoring.resource_capacity (
id serial NOT NULL, id serial NOT NULL,
resource_id integer NOT NULL REFERENCES virtual_instrument.resource ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, resource_id integer NOT NULL REFERENCES virtual_instrument.resource ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE,
...@@ -269,4 +286,18 @@ ALTER TABLE resource_allocation.resource_claim_extended_view ...@@ -269,4 +286,18 @@ ALTER TABLE resource_allocation.resource_claim_extended_view
COMMENT ON VIEW resource_allocation.resource_claim_extended_view COMMENT ON VIEW resource_allocation.resource_claim_extended_view
IS 'extended view on resource_claim table, including resource_claim_status.name and the resource itself'; IS 'extended view on resource_claim table, including resource_claim_status.name and the resource itself';
CREATE OR REPLACE VIEW resource_allocation.resource_claim_property_view AS
SELECT rcv.*, rcp.type_id as property_type_id, rcpt.name as property_type, rcp.value as property_value
FROM resource_allocation.resource_claim_view rcv
JOIN resource_allocation.resource_claim_property rcp ON rcv.id = rcp.resource_claim_id
JOIN resource_allocation.resource_claim_property_type rcpt ON rcpt.id = rcp.type_id;
ALTER TABLE resource_allocation.resource_claim_property_view
OWNER TO resourceassignment;
COMMENT ON VIEW resource_allocation.resource_claim_property_view
IS 'view including resource_claim_properties on resource_claim table for resource_claims with on or more properties';
COMMIT; COMMIT;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment