diff --git a/.gitattributes b/.gitattributes index 0315c5ddfd3a7acf540edd2204cd718043d26455..0e71b0300eb945641839648575de1476d8a36092 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4896,6 +4896,16 @@ SAS/ResourceAssignment/ResourceAssignmentDatabase/CMakeLists.txt -text SAS/ResourceAssignment/ResourceAssignmentDatabase/__init__.py -text SAS/ResourceAssignment/ResourceAssignmentDatabase/config.py -text SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/CMakeLists.txt -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/README -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_notifications.sql -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_resource_allocation_statics.sql -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_triggers.sql -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_virtual_instrument.sql -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_add_notifications.sql.py -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_add_virtual_instrument.sql.py -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_and_populate_database.sql -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_database.sql -text SAS/ResourceAssignment/ResourceAssignmentDatabase/radbbuslistener.py -text SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener -text SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.ini -text @@ -4910,7 +4920,10 @@ SAS/ResourceAssignment/ResourceAssignmentDatabase/sql/create_add_notifications.s SAS/ResourceAssignment/ResourceAssignmentDatabase/sql/create_add_virtual_instrument.sql.py -text SAS/ResourceAssignment/ResourceAssignmentDatabase/sql/create_and_populate_database.sql -text SAS/ResourceAssignment/ResourceAssignmentDatabase/sql/create_database.sql -text -SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/fill_database.sql -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/CMakeLists.txt -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.py -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.run -text +SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.sh -text SAS/ResourceAssignment/ResourceAssignmentEditor/CMakeLists.txt -text SAS/ResourceAssignment/ResourceAssignmentEditor/bin/CMakeLists.txt -text SAS/ResourceAssignment/ResourceAssignmentEditor/bin/raewebservice -text diff --git a/LCS/PyCommon/postgres.py b/LCS/PyCommon/postgres.py index c3fa92b62c9e435a039f07ef2d394ddc6a2711d6..59ea46dbe638189321acbe95949298cd922fcf00 100644 --- a/LCS/PyCommon/postgres.py +++ b/LCS/PyCommon/postgres.py @@ -119,12 +119,14 @@ class PostgresListener(object): host='', database='', username='', - password=''): + password='', + port=5432): '''Create a new PostgresListener''' self.conn = psycopg2.connect(host=host, user=username, password=password, - database=database) + database=database, + port=port) self.conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) self.cursor = self.conn.cursor() self.__listening = False diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/CMakeLists.txt b/SAS/ResourceAssignment/ResourceAssignmentDatabase/CMakeLists.txt index 69bf1a5629455aa0eaaad7d1e0d21844b62de124..b35f5924e90faeff1dabb306aaa046821384b829 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/CMakeLists.txt +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/CMakeLists.txt @@ -22,4 +22,15 @@ install(FILES radbpglistener.ini DESTINATION etc/supervisord.d) -add_subdirectory(sql) +add_subdirectory(radb/sql) +add_subdirectory(tests) + +# symmetric install of sql with symlinks in build share/... and normal install in installed/share/... +set(sql_files radb/sql/add_notifications.sql + radb/sql/add_triggers.sql + radb/sql/add_resource_allocation_statics.sql + radb/sql/add_virtual_instrument.sql + radb/sql/create_database.sql + radb/sql/create_and_populate_database.sql) + +lofar_add_data_files(${sql_files}) diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py index 9d45a23e1504fa873cfb0990c10eed7e1f384f27..d393ac5ef565f2328569c642f9222f40e5db911a 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py @@ -56,6 +56,7 @@ class RADatabase: user=self.dbcreds.user, password=self.dbcreds.password, database=self.dbcreds.database, + port=self.dbcreds.port, connect_timeout=5) self.cursor = self.conn.cursor(cursor_factory = psycopg2.extras.RealDictCursor) @@ -988,15 +989,15 @@ class RADatabase: if status is not None: def _claimStatusId(s): - #convert status string to status.id, if it is a string + #convert status string to status.id, if it is a string return self.getResourceClaimStatusId(s) if isinstance(s, basestring) else s if isinstance(status, (int, basestring)): # just a single id conditions.append('status_id = %s') - #convert status string to status.id, if it is a string + #convert status string to status.id, if it is a string qargs.append(_claimStatusId(status)) else: #assume a list/enumerable of id's conditions.append('status_id in %s') - #convert status string to status.id, if they are strings + #convert status string to status.id, if they are strings qargs.append(tuple([_claimStatusId(s) for s in status])) if claim_ids is not None: diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/CMakeLists.txt b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd62bc41019be68f32334ed7ca0473809f62c860 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/CMakeLists.txt @@ -0,0 +1,2 @@ +# $Id: CMakeLists.txt 32341 2015-08-28 11:59:26Z schaap $ + diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/README b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/README new file mode 100644 index 0000000000000000000000000000000000000000..bdb88dbe5682a3d23703aa6262862d42b0442ce8 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/README @@ -0,0 +1,35 @@ +------------------------------------- +SQL script update procedure +------------------------------------- +To update the .sql files in this directory, follow the following steps. + +SOURCE = directory of the root of your checkout + +* Build and install this package ("ResourceAssignmentDatabase"): + mkdir -p ~/build/gnu_opt && cd ~/build/gnu_opt + cmake -DBUILD_PACKAGES=ResourceAssignmentDatabase $SOURCE + make -j 8 install +* Add its paths to your environment: + source ~/build/gnu_opt/installed/lofarinit.sh +* Go back to this source dir + cd $SOURCE/SAS/ResourceAssignment/ResourceAssignmentDatabase/sql +* Regenerate the .sql files + ./create_add_notifications.sql.py + ./create_add_virtual_instrument.sql.py + +------------------------------------- +Database creation procedure (test system) +------------------------------------- +To create a fresh and empty RADB, follow the following steps. + +* Obtain credentials. Login as lofarsys@scu199 and: +* Copy *.sql to scu199 and go there: + scp *.sql scu199: + ssh scu199 +* Obtain/adjust the relevant credentials. As lofarsys: + cat ~/.lofar/dbcredentials/radb.ini +* If you want a NEW database, create one (see radb.ini for the relevant parameters): + (see create_database.sql) +* Reinitialise the database (see radb.ini for the relevant parameters): + psql -h $DBHOST $DATABASE -U $DBUSER -f create_and_populate_database.sql -W +* Ignore all NOTICES. diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_notifications.sql b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_notifications.sql new file mode 100644 index 0000000000000000000000000000000000000000..75b7008589043e296e1fd1cefd693497ef17c41f --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_notifications.sql @@ -0,0 +1,284 @@ +--this file was generated by create_add_notifications.sql.py +--it creates triggers and functions which fire postgres notify events upon the given table actions +--these notify events can be listened to implenting a subclass of the PostgresListener in the lofar.common.postgres python module +--for the radb such a subclass has been made, which listens specifically to the notifications defined below +--RADBPGListener in module lofar.sas.resourceassignment.database.radbpglistener +--this RADBPGListener then broadcasts the event on the lofar bus. + + +BEGIN; + +-- only issue >warnings log messages. (only during this transaction) +SET LOCAL client_min_messages=warning; + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_task_INSERT() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +SELECT CAST(NEW.id AS text) INTO payload; +PERFORM pg_notify(CAST('task_insert' AS text), payload); +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_task_INSERT +AFTER INSERT ON resource_allocation.task +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_task_INSERT(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_task_UPDATE() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +IF ROW(NEW.*) IS DISTINCT FROM ROW(OLD.*) THEN +SELECT CAST(NEW.id AS text) INTO payload; +PERFORM pg_notify(CAST('task_update' AS text), payload); +END IF; +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_task_UPDATE +AFTER UPDATE ON resource_allocation.task +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_task_UPDATE(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_task_DELETE() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +SELECT CAST(OLD.id AS text) INTO payload; +PERFORM pg_notify(CAST('task_delete' AS text), payload); +RETURN OLD; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_task_DELETE +AFTER DELETE ON resource_allocation.task +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_task_DELETE(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_task_predecessor_INSERT_column_task_id() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +SELECT CAST(NEW.task_id AS text) INTO payload; +PERFORM pg_notify(CAST('task_predecessor_insert_column_task_id' AS text), payload); +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_task_predecessor_INSERT_column_task_id +AFTER INSERT ON resource_allocation.task_predecessor +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_task_predecessor_INSERT_column_task_id(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_task_predecessor_UPDATE_column_task_id() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +IF ROW(NEW.*) IS DISTINCT FROM ROW(OLD.*) THEN +SELECT CAST(NEW.task_id AS text) INTO payload; +PERFORM pg_notify(CAST('task_predecessor_update_column_task_id' AS text), payload); +END IF; +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_task_predecessor_UPDATE_column_task_id +AFTER UPDATE ON resource_allocation.task_predecessor +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_task_predecessor_UPDATE_column_task_id(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_task_predecessor_DELETE_column_task_id() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +SELECT CAST(OLD.task_id AS text) INTO payload; +PERFORM pg_notify(CAST('task_predecessor_delete_column_task_id' AS text), payload); +RETURN OLD; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_task_predecessor_DELETE_column_task_id +AFTER DELETE ON resource_allocation.task_predecessor +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_task_predecessor_DELETE_column_task_id(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_task_predecessor_INSERT_column_predecessor_id() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +SELECT CAST(NEW.predecessor_id AS text) INTO payload; +PERFORM pg_notify(CAST('task_predecessor_insert_column_predecessor_id' AS text), payload); +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_task_predecessor_INSERT_column_predecessor_id +AFTER INSERT ON resource_allocation.task_predecessor +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_task_predecessor_INSERT_column_predecessor_id(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_task_predecessor_UPDATE_column_predecessor_id() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +IF ROW(NEW.*) IS DISTINCT FROM ROW(OLD.*) THEN +SELECT CAST(NEW.predecessor_id AS text) INTO payload; +PERFORM pg_notify(CAST('task_predecessor_update_column_predecessor_id' AS text), payload); +END IF; +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_task_predecessor_UPDATE_column_predecessor_id +AFTER UPDATE ON resource_allocation.task_predecessor +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_task_predecessor_UPDATE_column_predecessor_id(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_task_predecessor_DELETE_column_predecessor_id() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +SELECT CAST(OLD.predecessor_id AS text) INTO payload; +PERFORM pg_notify(CAST('task_predecessor_delete_column_predecessor_id' AS text), payload); +RETURN OLD; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_task_predecessor_DELETE_column_predecessor_id +AFTER DELETE ON resource_allocation.task_predecessor +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_task_predecessor_DELETE_column_predecessor_id(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_specification_UPDATE() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +IF ROW(NEW.*) IS DISTINCT FROM ROW(OLD.*) THEN +SELECT CAST(NEW.id AS text) INTO payload; +PERFORM pg_notify(CAST('specification_update' AS text), payload); +END IF; +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_specification_UPDATE +AFTER UPDATE ON resource_allocation.specification +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_specification_UPDATE(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_resource_claim_INSERT() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +SELECT CAST(NEW.id AS text) INTO payload; +PERFORM pg_notify(CAST('resource_claim_insert' AS text), payload); +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_resource_claim_INSERT +AFTER INSERT ON resource_allocation.resource_claim +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_resource_claim_INSERT(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_resource_claim_UPDATE() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +IF ROW(NEW.*) IS DISTINCT FROM ROW(OLD.*) THEN +SELECT CAST(NEW.id AS text) INTO payload; +PERFORM pg_notify(CAST('resource_claim_update' AS text), payload); +END IF; +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_resource_claim_UPDATE +AFTER UPDATE ON resource_allocation.resource_claim +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_resource_claim_UPDATE(); + + +CREATE OR REPLACE FUNCTION resource_allocation.NOTIFY_resource_claim_DELETE() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +SELECT CAST(OLD.id AS text) INTO payload; +PERFORM pg_notify(CAST('resource_claim_delete' AS text), payload); +RETURN OLD; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_resource_claim_DELETE +AFTER DELETE ON resource_allocation.resource_claim +FOR EACH ROW +EXECUTE PROCEDURE resource_allocation.NOTIFY_resource_claim_DELETE(); + + +CREATE OR REPLACE FUNCTION resource_monitoring.NOTIFY_resource_availability_UPDATE_column_resource_id() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +IF ROW(NEW.*) IS DISTINCT FROM ROW(OLD.*) THEN +SELECT CAST(NEW.resource_id AS text) INTO payload; +PERFORM pg_notify(CAST('resource_availability_update_column_resource_id' AS text), payload); +END IF; +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_resource_availability_UPDATE_column_resource_id +AFTER UPDATE ON resource_monitoring.resource_availability +FOR EACH ROW +EXECUTE PROCEDURE resource_monitoring.NOTIFY_resource_availability_UPDATE_column_resource_id(); + + +CREATE OR REPLACE FUNCTION resource_monitoring.NOTIFY_resource_capacity_UPDATE_column_resource_id() +RETURNS TRIGGER AS $$ +DECLARE payload text; +BEGIN +IF ROW(NEW.*) IS DISTINCT FROM ROW(OLD.*) THEN +SELECT CAST(NEW.resource_id AS text) INTO payload; +PERFORM pg_notify(CAST('resource_capacity_update_column_resource_id' AS text), payload); +END IF; +RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE TRIGGER T_NOTIFY_resource_capacity_UPDATE_column_resource_id +AFTER UPDATE ON resource_monitoring.resource_capacity +FOR EACH ROW +EXECUTE PROCEDURE resource_monitoring.NOTIFY_resource_capacity_UPDATE_column_resource_id(); + + +COMMIT; diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_resource_allocation_statics.sql b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_resource_allocation_statics.sql new file mode 100644 index 0000000000000000000000000000000000000000..28d92092c1f15a1c095aa06f3a602c77b23c1a69 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_resource_allocation_statics.sql @@ -0,0 +1,23 @@ +-- resourceassignment password for testing on mcu005 is the same as the password on the president's luggage +6 +-- psql resourceassignment -U resourceassignment -f add_resource_allocation_statics.sql -W +BEGIN; + +INSERT INTO resource_allocation.task_status VALUES (200, 'prepared'), (300, 'approved'), (320, 'on_hold'), (335, 'conflict'), +(350, 'prescheduled'), (400, 'scheduled'), (500, 'queued'), (600, 'active'), (900, 'completing'), (1000, 'finished'), (1100, 'aborted'), +(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'),(2, 'reservation'); -- 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_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_img_files'),(5, 'nr_of_pulp_files'),(6, 'nr_of_cs_stokes'),(7, 'nr_of_is_stokes'),(8, 'is_file_size'),(9, 'cs_file_size'),(10, 'uv_file_size'),(11, 'im_file_size'),(12, 'img_file_size'),(13, 'nr_of_pulp_files'),(14, 'nr_of_cs_parts'),(15, 'start_sb_nr'),(16,'uv_otdb_id'),(17,'cs_otdb_id'),(18,'is_otdb_id'),(19,'im_otdb_id'),(20,'img_otdb_id'),(21,'pulp_otdb_id'),(22, 'is_tab_nr'),(23, 'start_sbg_nr'),(24, 'pulp_file_size'); +INSERT INTO resource_allocation.resource_claim_property_io_type VALUES (0, 'output'),(1, 'input'); +INSERT INTO resource_allocation.config VALUES (0, 'max_fill_ratio_CEP4_storage', '0.85'), (1, 'claim_timeout', '172800'), (2, 'min_inter_task_delay', '60'), (3, 'max_fill_ratio_CEP4_bandwidth', '0.75'); -- Just some values 172800 is two days in seconds +INSERT INTO resource_allocation.conflict_reason +VALUES +(1, 'Not enough total free storage space'), +(2, 'Storage node inactive'), +(3, 'Number of storage nodes available less than minimum required'), +(4, 'No suitable storage options found'), +(5, 'No storage nodes available'), +(6, 'Not enough available storage nodes for required bandwidth'), +(7, 'Network bandwidth to storage node too high'), +(8, 'Bandwidth required for single file too high'); +COMMIT; diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_triggers.sql b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_triggers.sql new file mode 100644 index 0000000000000000000000000000000000000000..5686fc819241bcf8fefbc933697abc7436956c89 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_triggers.sql @@ -0,0 +1,240 @@ +--add triggers and trigger functions to radb (note, there are also the notification triggers in the add_notifications.sql file) + +BEGIN; + +-- only issue >warnings log messages. (only during this transaction) +SET LOCAL client_min_messages=warning; + +DROP TRIGGER IF EXISTS T_delete_resource_claims_for_approved_task ON resource_allocation.task CASCADE; +DROP FUNCTION IF EXISTS resource_allocation.delete_resource_claims_for_approved_task(); + +CREATE OR REPLACE FUNCTION resource_allocation.delete_resource_claims_for_approved_task() + RETURNS trigger AS +$BODY$ +BEGIN + IF NEW.status_id <> OLD.status_id AND NEW.status_id = 300 THEN + DELETE FROM resource_allocation.resource_claim rc WHERE rc.task_id = NEW.id; + END IF; +RETURN NEW; +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; +ALTER FUNCTION resource_allocation.delete_resource_claims_for_approved_task() + OWNER TO resourceassignment; +COMMENT ON FUNCTION resource_allocation.delete_resource_claims_for_approved_task() + IS 'function which is called by task table update trigger, which deletes all the tasks resource claims.'; + +CREATE TRIGGER T_delete_resource_claims_for_approved_task + AFTER UPDATE + ON resource_allocation.task + FOR EACH ROW + EXECUTE PROCEDURE resource_allocation.delete_resource_claims_for_approved_task(); +COMMENT ON TRIGGER T_delete_resource_claims_for_approved_task ON resource_allocation.task + IS 'task table update trigger, calls the resource_allocation.delete_resource_claims_for_approved_task() function.'; + +--------------------------------------------------------------------------------------------------------------------- + +DROP TRIGGER IF EXISTS T_delete_conflict_reasons_after_resource_claim_update ON resource_allocation.resource_claim CASCADE; +DROP FUNCTION IF EXISTS resource_allocation.delete_conflict_reasons_after_resource_claim_update(); + +CREATE OR REPLACE FUNCTION resource_allocation.delete_conflict_reasons_after_resource_claim_update() + RETURNS trigger AS +$BODY$ +BEGIN + IF OLD.status_id = 2 AND NEW.status_id <> 2 THEN --new status is not conflict + DELETE FROM resource_allocation.resource_claim_conflict_reason rccr WHERE rccr.resource_claim_id = NEW.id; + END IF; +RETURN NEW; +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; +ALTER FUNCTION resource_allocation.delete_conflict_reasons_after_resource_claim_update() + OWNER TO resourceassignment; +COMMENT ON FUNCTION resource_allocation.delete_conflict_reasons_after_resource_claim_update() + IS 'function which is called by resource_claim table update trigger, which deletes resource_claim_conflict_reasons when the claim status is updated to !conflict.'; + +CREATE TRIGGER T_delete_conflict_reasons_after_resource_claim_update + AFTER UPDATE + ON resource_allocation.resource_claim + FOR EACH ROW + EXECUTE PROCEDURE resource_allocation.delete_conflict_reasons_after_resource_claim_update(); + +--------------------------------------------------------------------------------------------------------------------- + +DROP TRIGGER IF EXISTS T_before_insert_conflict_reason_do_resource_claim_status_check ON resource_allocation.resource_claim_conflict_reason CASCADE; +DROP FUNCTION IF EXISTS resource_allocation.before_insert_conflict_reason_do_resource_claim_status_check(); + +CREATE OR REPLACE FUNCTION resource_allocation.before_insert_conflict_reason_do_resource_claim_status_check() + RETURNS trigger AS +$BODY$ +BEGIN + -- check if referred resource_claim is in conflict status, else raise + IF (SELECT COUNT(id) FROM resource_allocation.resource_claim rc WHERE rc.id = NEW.resource_claim_id AND rc.status_id = 2) = 0 THEN + RAISE EXCEPTION 'resource_claim has no conflict status'; + END IF; +RETURN NEW; +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; +ALTER FUNCTION resource_allocation.before_insert_conflict_reason_do_resource_claim_status_check() + OWNER TO resourceassignment; +COMMENT ON FUNCTION resource_allocation.before_insert_conflict_reason_do_resource_claim_status_check() + IS 'check if referred resource_claim is in conflict status, else raise'; + +CREATE TRIGGER T_before_insert_conflict_reason_do_resource_claim_status_check + BEFORE INSERT + ON resource_allocation.resource_claim_conflict_reason + FOR EACH ROW + EXECUTE PROCEDURE resource_allocation.before_insert_conflict_reason_do_resource_claim_status_check(); + +--------------------------------------------------------------------------------------------------------------------- + +DROP TRIGGER IF EXISTS T_delete_conflict_reasons_after_task_update ON resource_allocation.task CASCADE; +DROP FUNCTION IF EXISTS resource_allocation.delete_conflict_reasons_after_task_update(); + +CREATE OR REPLACE FUNCTION resource_allocation.delete_conflict_reasons_after_task_update() + RETURNS trigger AS +$BODY$ +BEGIN + IF OLD.status_id = 335 AND NEW.status_id <> 335 THEN --new status is not conflict + DELETE FROM resource_allocation.task_conflict_reason tcr WHERE tcr.task_id = NEW.id; + END IF; +RETURN NEW; +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; +ALTER FUNCTION resource_allocation.delete_conflict_reasons_after_task_update() + OWNER TO resourceassignment; +COMMENT ON FUNCTION resource_allocation.delete_conflict_reasons_after_task_update() + IS 'function which is called by task table update trigger, which deletes task_conflict_reasons when the task status is updated to !conflict.'; + +CREATE TRIGGER T_delete_conflict_reasons_after_task_update + AFTER UPDATE + ON resource_allocation.task + FOR EACH ROW + EXECUTE PROCEDURE resource_allocation.delete_conflict_reasons_after_task_update(); + +--------------------------------------------------------------------------------------------------------------------- + +DROP TRIGGER IF EXISTS T_before_insert_conflict_reason_do_task_status_check ON resource_allocation.task_conflict_reason CASCADE; +DROP FUNCTION IF EXISTS resource_allocation.before_insert_conflict_reason_do_task_status_check(); + +CREATE OR REPLACE FUNCTION resource_allocation.before_insert_conflict_reason_do_task_status_check() + RETURNS trigger AS +$BODY$ +BEGIN + -- check if referred task is in conflict status, else raise + IF (SELECT COUNT(id) FROM resource_allocation.task task WHERE task.id = NEW.task_id AND task.status_id = 335) = 0 THEN + RAISE EXCEPTION 'task has no conflict status'; + END IF; +RETURN NEW; +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; +ALTER FUNCTION resource_allocation.before_insert_conflict_reason_do_task_status_check() + OWNER TO resourceassignment; +COMMENT ON FUNCTION resource_allocation.before_insert_conflict_reason_do_task_status_check() + IS 'check if referred task is in conflict status, else raise'; + +CREATE TRIGGER T_before_insert_conflict_reason_do_task_status_check + BEFORE INSERT + ON resource_allocation.task_conflict_reason + FOR EACH ROW + EXECUTE PROCEDURE resource_allocation.before_insert_conflict_reason_do_task_status_check(); + +--------------------------------------------------------------------------------------------------------------------- + +DROP TRIGGER IF EXISTS T_specification_insertupdate_check_startendtimes ON resource_allocation.specification; +DROP FUNCTION IF EXISTS resource_allocation.on_insertupdate_check_specification_startendtimes(); + +CREATE OR REPLACE FUNCTION resource_allocation.on_insertupdate_check_specification_startendtimes() + RETURNS trigger AS +$BODY$ +DECLARE +task RECORD; +pred_task RECORD; +suc_task RECORD; +predecessor_task_id int; +successor_task_id int; +moved_seconds double precision; +duration double precision; +max_pred_endtime timestamp := '1900-01-01 00:00:00'; +tmp_time timestamp; +min_starttime timestamp; +min_inter_task_delay int; +BEGIN + --swap start/end time if needed + IF NEW.starttime > NEW.endtime THEN + RAISE NOTICE 'NEW.starttime > NEW.endtime'; + tmp_time := NEW.starttime; + NEW.starttime := NEW.endtime; + NEW.endtime := tmp_time; + END IF; + + --store task duration + SELECT EXTRACT(epoch FROM age(NEW.endtime, NEW.starttime)) INTO duration; + + --deterimine max_pred_endtime + FOR task IN SELECT * FROM resource_allocation.task_view tv WHERE tv.specification_id = NEW.id LOOP + IF task.predecessor_ids IS NOT NULL THEN + FOREACH predecessor_task_id IN ARRAY task.predecessor_ids LOOP + FOR pred_task IN SELECT * FROM resource_allocation.task_view tv WHERE tv.id = predecessor_task_id LOOP + IF pred_task.endtime > max_pred_endtime THEN + max_pred_endtime := pred_task.endtime; + END IF; + END LOOP; + END LOOP; + END IF; + END LOOP; + + --check if spec is before max_pred_endtime, correct if needed. + IF max_pred_endtime > '1900-01-01 00:00:00' THEN + SELECT c.value::integer INTO min_inter_task_delay FROM resource_allocation.config c WHERE c.name = 'min_inter_task_delay'; + IF min_inter_task_delay IS NULL THEN + min_inter_task_delay := 0; + END IF; + min_starttime := max_pred_endtime + min_inter_task_delay * interval '1 second'; + IF min_starttime > NEW.starttime THEN + NEW.starttime := min_starttime; + NEW.endtime := min_starttime + duration * interval '1 second'; + END IF; + END IF; + + --move successor tasks by same amount if needed + IF TG_OP = 'UPDATE' THEN + IF NEW.endtime <> OLD.endtime THEN + SELECT EXTRACT(epoch FROM age(NEW.endtime, OLD.endtime)) INTO moved_seconds; + FOR task IN SELECT * FROM resource_allocation.task_view tv WHERE tv.specification_id = NEW.id LOOP + IF task.successor_ids IS NOT NULL THEN + FOREACH successor_task_id IN ARRAY task.successor_ids LOOP + FOR suc_task IN SELECT * FROM resource_allocation.task_view tv WHERE tv.id = successor_task_id LOOP + UPDATE resource_allocation.specification SET (starttime, endtime) = (starttime + moved_seconds * interval '1 second', endtime + moved_seconds * interval '1 second') WHERE id = suc_task.specification_id; + END LOOP; + END LOOP; + END IF; + END LOOP; + END IF; + END IF; + +RETURN NEW; +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; +ALTER FUNCTION resource_allocation.on_insertupdate_check_specification_startendtimes() + OWNER TO resourceassignment; + +CREATE TRIGGER T_specification_insertupdate_check_startendtimes + BEFORE INSERT OR UPDATE + ON resource_allocation.specification + FOR EACH ROW + EXECUTE PROCEDURE resource_allocation.on_insertupdate_check_specification_startendtimes(); + +--------------------------------------------------------------------------------------------------------------------- + +COMMIT; diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_virtual_instrument.sql b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_virtual_instrument.sql new file mode 100644 index 0000000000000000000000000000000000000000..c1b0bfb096e42445b827677321c92f2b04f01e4b --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_virtual_instrument.sql @@ -0,0 +1,27 @@ +-- This file was generated by the 'create_add_virtual_instrument.sql.py' script. +-- Please do not modify this sql file, but modify and the python script if you want a different virtual instrument. + +-- resourceassignment password for testing on mcu005 is the same as the password on the president's luggage +6 +-- psql resourceassignment -U resourceassignment -f add_virtual_instrument.sql -W +BEGIN; +-- start with clearing the old virtual instrument model +-- for some reason truncate takes a looooong time to complete, so use delete from +DELETE FROM virtual_instrument.resource_group_to_resource_group CASCADE; +DELETE FROM virtual_instrument.resource_to_resource_group CASCADE; +DELETE FROM virtual_instrument.resource_group CASCADE; +DELETE FROM virtual_instrument.resource_group_type CASCADE; +DELETE FROM virtual_instrument.resource CASCADE; +DELETE FROM virtual_instrument.resource_type CASCADE; +DELETE FROM virtual_instrument.unit CASCADE; +-- end of initial cleanup + +INSERT INTO virtual_instrument.unit VALUES (0, 'rsp_channel_bit'), (1, 'bytes'), (2, 'rcu_board'), (3, 'bits/second'), (4, 'cores'); +INSERT INTO virtual_instrument.resource_type VALUES (0, 'rsp', 0), (1, 'tbb', 1), (2, 'rcu', 2), (3, 'bandwidth', 3), (4, 'processor', 4), (5, 'storage', 1); +INSERT INTO virtual_instrument.resource_group_type VALUES (0, 'instrument'), (1, 'cluster'), (2, 'station_group'), (3, 'station'), (4, 'virtual'), (5, 'node'), (6, 'rsp'); +INSERT INTO virtual_instrument.resource_group VALUES (0, 'LOFAR', 0), (1, 'CEP4', 1), (2, 'COBALT', 1), (3, 'computenodes', 4), (4, 'gpunodes', 4), (5, 'cpunode01', 5), (6, 'cpunode02', 5), (7, 'cpunode03', 5), (8, 'cpunode04', 5), (9, 'cpunode05', 5), (10, 'cpunode06', 5), (11, 'cpunode07', 5), (12, 'cpunode08', 5), (13, 'cpunode09', 5), (14, 'cpunode10', 5), (15, 'cpunode11', 5), (16, 'cpunode12', 5), (17, 'cpunode13', 5), (18, 'cpunode14', 5), (19, 'cpunode15', 5), (20, 'cpunode16', 5), (21, 'cpunode17', 5), (22, 'cpunode18', 5), (23, 'cpunode19', 5), (24, 'cpunode20', 5), (25, 'cpunode21', 5), (26, 'cpunode22', 5), (27, 'cpunode23', 5), (28, 'cpunode24', 5), (29, 'cpunode25', 5), (30, 'cpunode26', 5), (31, 'cpunode27', 5), (32, 'cpunode28', 5), (33, 'cpunode29', 5), (34, 'cpunode30', 5), (35, 'cpunode31', 5), (36, 'cpunode32', 5), (37, 'cpunode33', 5), (38, 'cpunode34', 5), (39, 'cpunode35', 5), (40, 'cpunode36', 5), (41, 'cpunode37', 5), (42, 'cpunode38', 5), (43, 'cpunode39', 5), (44, 'cpunode40', 5), (45, 'cpunode41', 5), (46, 'cpunode42', 5), (47, 'cpunode43', 5), (48, 'cpunode44', 5), (49, 'cpunode45', 5), (50, 'cpunode46', 5), (51, 'cpunode47', 5), (52, 'cpunode48', 5), (53, 'cpunode49', 5), (54, 'cpunode50', 5), (55, 'cbt001', 5), (56, 'cbt002', 5), (57, 'cbt003', 5), (58, 'cbt004', 5), (59, 'cbt005', 5), (60, 'cbt006', 5), (61, 'cbt007', 5), (62, 'cbt008', 5), (63, 'DRAGNET', 1), (64, 'drgnodes', 4), (65, 'dragproc', 5), (66, 'drg01', 5), (67, 'drg01-data1', 4), (68, 'drg01-data2', 4), (69, 'drg02', 5), (70, 'drg02-data1', 4), (71, 'drg02-data2', 4), (72, 'drg03', 5), (73, 'drg03-data1', 4), (74, 'drg03-data2', 4), (75, 'drg04', 5), (76, 'drg04-data1', 4), (77, 'drg04-data2', 4), (78, 'drg05', 5), (79, 'drg05-data1', 4), (80, 'drg05-data2', 4), (81, 'drg06', 5), (82, 'drg06-data1', 4), (83, 'drg06-data2', 4), (84, 'drg07', 5), (85, 'drg07-data1', 4), (86, 'drg07-data2', 4), (87, 'drg08', 5), (88, 'drg08-data1', 4), (89, 'drg08-data2', 4), (90, 'drg09', 5), (91, 'drg09-data1', 4), (92, 'drg09-data2', 4), (93, 'drg10', 5), (94, 'drg10-data1', 4), (95, 'drg10-data2', 4), (96, 'drg11', 5), (97, 'drg11-data1', 4), (98, 'drg11-data2', 4), (99, 'drg12', 5), (100, 'drg12-data1', 4), (101, 'drg12-data2', 4), (102, 'drg13', 5), (103, 'drg13-data1', 4), (104, 'drg13-data2', 4), (105, 'drg14', 5), (106, 'drg14-data1', 4), (107, 'drg14-data2', 4), (108, 'drg15', 5), (109, 'drg15-data1', 4), (110, 'drg15-data2', 4), (111, 'drg16', 5), (112, 'drg16-data1', 4), (113, 'drg16-data2', 4), (114, 'drg17', 5), (115, 'drg17-data1', 4), (116, 'drg17-data2', 4), (117, 'drg18', 5), (118, 'drg18-data1', 4), (119, 'drg18-data2', 4), (120, 'drg19', 5), (121, 'drg19-data1', 4), (122, 'drg19-data2', 4), (123, 'drg20', 5), (124, 'drg20-data1', 4), (125, 'drg20-data2', 4), (126, 'drg21', 5), (127, 'drg21-data1', 4), (128, 'drg21-data2', 4), (129, 'drg22', 5), (130, 'drg22-data1', 4), (131, 'drg22-data2', 4), (132, 'drg23', 5), (133, 'drg23-data1', 4), (134, 'drg23-data2', 4), (135, 'CORE', 2), (136, 'REMOTE', 2), (137, 'INTERNATIONAL', 2), (138, 'SUPERTERP', 4), (139, 'ALL', 4), (140, 'NL', 4), (141, 'CoreSansST', 4), (142, 'VLBI', 4), (143, 'AARTFAAC', 4), (144, 'CORE2KM', 4), (145, 'LORA', 4), (149, 'CS001', 3), (150, 'CS002', 3), (151, 'CS003', 3), (152, 'CS004', 3), (153, 'CS005', 3), (154, 'CS006', 3), (155, 'CS007', 3), (156, 'CS011', 3), (157, 'CS013', 3), (158, 'CS017', 3), (159, 'CS021', 3), (160, 'CS024', 3), (161, 'CS026', 3), (162, 'CS028', 3), (163, 'CS030', 3), (164, 'CS031', 3), (165, 'CS032', 3), (166, 'CS101', 3), (167, 'CS103', 3), (168, 'CS201', 3), (169, 'CS301', 3), (170, 'CS302', 3), (171, 'CS401', 3), (172, 'CS501', 3), (173, 'RS106', 3), (174, 'RS205', 3), (175, 'RS208', 3), (176, 'RS210', 3), (177, 'RS305', 3), (178, 'RS306', 3), (179, 'RS307', 3), (180, 'RS310', 3), (181, 'RS406', 3), (182, 'RS407', 3), (183, 'RS408', 3), (184, 'RS409', 3), (185, 'RS503', 3), (186, 'RS508', 3), (187, 'RS509', 3), (188, 'DE601', 3), (189, 'DE602', 3), (190, 'DE603', 3), (191, 'DE604', 3), (192, 'DE605', 3), (193, 'FR606', 3), (194, 'SE607', 3), (195, 'UK608', 3), (196, 'DE609', 3), (197, 'PL610', 3), (198, 'PL611', 3), (199, 'PL612', 3), (200, 'IE613', 3), (201, 'IS614', 3), (202, 'TEST1', 3), (206, 'CS001RSP0', 6), (207, 'CS001RSP1', 6), (208, 'CS002RSP0', 6), (209, 'CS002RSP1', 6), (210, 'CS003RSP0', 6), (211, 'CS003RSP1', 6), (212, 'CS004RSP0', 6), (213, 'CS004RSP1', 6), (214, 'CS005RSP0', 6), (215, 'CS005RSP1', 6), (216, 'CS006RSP0', 6), (217, 'CS006RSP1', 6), (218, 'CS007RSP0', 6), (219, 'CS007RSP1', 6), (220, 'CS011RSP0', 6), (221, 'CS011RSP1', 6), (222, 'CS013RSP0', 6), (223, 'CS013RSP1', 6), (224, 'CS017RSP0', 6), (225, 'CS017RSP1', 6), (226, 'CS021RSP0', 6), (227, 'CS021RSP1', 6), (228, 'CS024RSP0', 6), (229, 'CS024RSP1', 6), (230, 'CS026RSP0', 6), (231, 'CS026RSP1', 6), (232, 'CS028RSP0', 6), (233, 'CS028RSP1', 6), (234, 'CS030RSP0', 6), (235, 'CS030RSP1', 6), (236, 'CS031RSP0', 6), (237, 'CS031RSP1', 6), (238, 'CS032RSP0', 6), (239, 'CS032RSP1', 6), (240, 'CS101RSP0', 6), (241, 'CS101RSP1', 6), (242, 'CS103RSP0', 6), (243, 'CS103RSP1', 6), (244, 'CS201RSP0', 6), (245, 'CS201RSP1', 6), (246, 'CS301RSP0', 6), (247, 'CS301RSP1', 6), (248, 'CS302RSP0', 6), (249, 'CS302RSP1', 6), (250, 'CS401RSP0', 6), (251, 'CS401RSP1', 6), (252, 'CS501RSP0', 6), (253, 'CS501RSP1', 6), (254, 'RS106RSP', 6), (255, 'RS205RSP', 6), (256, 'RS208RSP', 6), (257, 'RS210RSP', 6), (258, 'RS305RSP', 6), (259, 'RS306RSP', 6), (260, 'RS307RSP', 6), (261, 'RS310RSP', 6), (262, 'RS406RSP', 6), (263, 'RS407RSP', 6), (264, 'RS408RSP', 6), (265, 'RS409RSP', 6), (266, 'RS503RSP', 6), (267, 'RS508RSP', 6), (268, 'RS509RSP', 6), (269, 'DE601RSP', 6), (270, 'DE602RSP', 6), (271, 'DE603RSP', 6), (272, 'DE604RSP', 6), (273, 'DE605RSP', 6), (274, 'FR606RSP', 6), (275, 'SE607RSP', 6), (276, 'UK608RSP', 6), (277, 'DE609RSP', 6), (278, 'PL610RSP', 6), (279, 'PL611RSP', 6), (280, 'PL612RSP', 6), (281, 'IE613RSP', 6), (282, 'IS614RSP', 6), (283, 'TEST1RSP', 6); +INSERT INTO virtual_instrument.resource VALUES (0, 'cpunode01_bandwidth', 3), (1, 'cpunode01_processors', 4), (2, 'cpunode02_bandwidth', 3), (3, 'cpunode02_processors', 4), (4, 'cpunode03_bandwidth', 3), (5, 'cpunode03_processors', 4), (6, 'cpunode04_bandwidth', 3), (7, 'cpunode04_processors', 4), (8, 'cpunode05_bandwidth', 3), (9, 'cpunode05_processors', 4), (10, 'cpunode06_bandwidth', 3), (11, 'cpunode06_processors', 4), (12, 'cpunode07_bandwidth', 3), (13, 'cpunode07_processors', 4), (14, 'cpunode08_bandwidth', 3), (15, 'cpunode08_processors', 4), (16, 'cpunode09_bandwidth', 3), (17, 'cpunode09_processors', 4), (18, 'cpunode10_bandwidth', 3), (19, 'cpunode10_processors', 4), (20, 'cpunode11_bandwidth', 3), (21, 'cpunode11_processors', 4), (22, 'cpunode12_bandwidth', 3), (23, 'cpunode12_processors', 4), (24, 'cpunode13_bandwidth', 3), (25, 'cpunode13_processors', 4), (26, 'cpunode14_bandwidth', 3), (27, 'cpunode14_processors', 4), (28, 'cpunode15_bandwidth', 3), (29, 'cpunode15_processors', 4), (30, 'cpunode16_bandwidth', 3), (31, 'cpunode16_processors', 4), (32, 'cpunode17_bandwidth', 3), (33, 'cpunode17_processors', 4), (34, 'cpunode18_bandwidth', 3), (35, 'cpunode18_processors', 4), (36, 'cpunode19_bandwidth', 3), (37, 'cpunode19_processors', 4), (38, 'cpunode20_bandwidth', 3), (39, 'cpunode20_processors', 4), (40, 'cpunode21_bandwidth', 3), (41, 'cpunode21_processors', 4), (42, 'cpunode22_bandwidth', 3), (43, 'cpunode22_processors', 4), (44, 'cpunode23_bandwidth', 3), (45, 'cpunode23_processors', 4), (46, 'cpunode24_bandwidth', 3), (47, 'cpunode24_processors', 4), (48, 'cpunode25_bandwidth', 3), (49, 'cpunode25_processors', 4), (50, 'cpunode26_bandwidth', 3), (51, 'cpunode26_processors', 4), (52, 'cpunode27_bandwidth', 3), (53, 'cpunode27_processors', 4), (54, 'cpunode28_bandwidth', 3), (55, 'cpunode28_processors', 4), (56, 'cpunode29_bandwidth', 3), (57, 'cpunode29_processors', 4), (58, 'cpunode30_bandwidth', 3), (59, 'cpunode30_processors', 4), (60, 'cpunode31_bandwidth', 3), (61, 'cpunode31_processors', 4), (62, 'cpunode32_bandwidth', 3), (63, 'cpunode32_processors', 4), (64, 'cpunode33_bandwidth', 3), (65, 'cpunode33_processors', 4), (66, 'cpunode34_bandwidth', 3), (67, 'cpunode34_processors', 4), (68, 'cpunode35_bandwidth', 3), (69, 'cpunode35_processors', 4), (70, 'cpunode36_bandwidth', 3), (71, 'cpunode36_processors', 4), (72, 'cpunode37_bandwidth', 3), (73, 'cpunode37_processors', 4), (74, 'cpunode38_bandwidth', 3), (75, 'cpunode38_processors', 4), (76, 'cpunode39_bandwidth', 3), (77, 'cpunode39_processors', 4), (78, 'cpunode40_bandwidth', 3), (79, 'cpunode40_processors', 4), (80, 'cpunode41_bandwidth', 3), (81, 'cpunode41_processors', 4), (82, 'cpunode42_bandwidth', 3), (83, 'cpunode42_processors', 4), (84, 'cpunode43_bandwidth', 3), (85, 'cpunode43_processors', 4), (86, 'cpunode44_bandwidth', 3), (87, 'cpunode44_processors', 4), (88, 'cpunode45_bandwidth', 3), (89, 'cpunode45_processors', 4), (90, 'cpunode46_bandwidth', 3), (91, 'cpunode46_processors', 4), (92, 'cpunode47_bandwidth', 3), (93, 'cpunode47_processors', 4), (94, 'cpunode48_bandwidth', 3), (95, 'cpunode48_processors', 4), (96, 'cpunode49_bandwidth', 3), (97, 'cpunode49_processors', 4), (98, 'cpunode50_bandwidth', 3), (99, 'cpunode50_processors', 4), (100, 'cbt001_bandwidth', 3), (101, 'cbt001_processors', 4), (102, 'cbt002_bandwidth', 3), (103, 'cbt002_processors', 4), (104, 'cbt003_bandwidth', 3), (105, 'cbt003_processors', 4), (106, 'cbt004_bandwidth', 3), (107, 'cbt004_processors', 4), (108, 'cbt005_bandwidth', 3), (109, 'cbt005_processors', 4), (110, 'cbt006_bandwidth', 3), (111, 'cbt006_processors', 4), (112, 'cbt007_bandwidth', 3), (113, 'cbt007_processors', 4), (114, 'cbt008_bandwidth', 3), (115, 'cbt008_processors', 4), (116, 'CEP4_bandwidth:/data', 3), (117, 'CEP4_storage:/data', 5), (118, 'dragproc_bandwidth:/data', 3), (119, 'dragproc_storage:/data', 5), (120, 'drg01_bandwidth:/data1', 3), (121, 'drg01_bandwidth:/data2', 3), (122, 'drg01_storage:/data1', 5), (123, 'drg01_storage:/data2', 5), (124, 'drg02_bandwidth:/data1', 3), (125, 'drg02_bandwidth:/data2', 3), (126, 'drg02_storage:/data1', 5), (127, 'drg02_storage:/data2', 5), (128, 'drg03_bandwidth:/data1', 3), (129, 'drg03_bandwidth:/data2', 3), (130, 'drg03_storage:/data1', 5), (131, 'drg03_storage:/data2', 5), (132, 'drg04_bandwidth:/data1', 3), (133, 'drg04_bandwidth:/data2', 3), (134, 'drg04_storage:/data1', 5), (135, 'drg04_storage:/data2', 5), (136, 'drg05_bandwidth:/data1', 3), (137, 'drg05_bandwidth:/data2', 3), (138, 'drg05_storage:/data1', 5), (139, 'drg05_storage:/data2', 5), (140, 'drg06_bandwidth:/data1', 3), (141, 'drg06_bandwidth:/data2', 3), (142, 'drg06_storage:/data1', 5), (143, 'drg06_storage:/data2', 5), (144, 'drg07_bandwidth:/data1', 3), (145, 'drg07_bandwidth:/data2', 3), (146, 'drg07_storage:/data1', 5), (147, 'drg07_storage:/data2', 5), (148, 'drg08_bandwidth:/data1', 3), (149, 'drg08_bandwidth:/data2', 3), (150, 'drg08_storage:/data1', 5), (151, 'drg08_storage:/data2', 5), (152, 'drg09_bandwidth:/data1', 3), (153, 'drg09_bandwidth:/data2', 3), (154, 'drg09_storage:/data1', 5), (155, 'drg09_storage:/data2', 5), (156, 'drg10_bandwidth:/data1', 3), (157, 'drg10_bandwidth:/data2', 3), (158, 'drg10_storage:/data1', 5), (159, 'drg10_storage:/data2', 5), (160, 'drg11_bandwidth:/data1', 3), (161, 'drg11_bandwidth:/data2', 3), (162, 'drg11_storage:/data1', 5), (163, 'drg11_storage:/data2', 5), (164, 'drg12_bandwidth:/data1', 3), (165, 'drg12_bandwidth:/data2', 3), (166, 'drg12_storage:/data1', 5), (167, 'drg12_storage:/data2', 5), (168, 'drg13_bandwidth:/data1', 3), (169, 'drg13_bandwidth:/data2', 3), (170, 'drg13_storage:/data1', 5), (171, 'drg13_storage:/data2', 5), (172, 'drg14_bandwidth:/data1', 3), (173, 'drg14_bandwidth:/data2', 3), (174, 'drg14_storage:/data1', 5), (175, 'drg14_storage:/data2', 5), (176, 'drg15_bandwidth:/data1', 3), (177, 'drg15_bandwidth:/data2', 3), (178, 'drg15_storage:/data1', 5), (179, 'drg15_storage:/data2', 5), (180, 'drg16_bandwidth:/data1', 3), (181, 'drg16_bandwidth:/data2', 3), (182, 'drg16_storage:/data1', 5), (183, 'drg16_storage:/data2', 5), (184, 'drg17_bandwidth:/data1', 3), (185, 'drg17_bandwidth:/data2', 3), (186, 'drg17_storage:/data1', 5), (187, 'drg17_storage:/data2', 5), (188, 'drg18_bandwidth:/data1', 3), (189, 'drg18_bandwidth:/data2', 3), (190, 'drg18_storage:/data1', 5), (191, 'drg18_storage:/data2', 5), (192, 'drg19_bandwidth:/data1', 3), (193, 'drg19_bandwidth:/data2', 3), (194, 'drg19_storage:/data1', 5), (195, 'drg19_storage:/data2', 5), (196, 'drg20_bandwidth:/data1', 3), (197, 'drg20_bandwidth:/data2', 3), (198, 'drg20_storage:/data1', 5), (199, 'drg20_storage:/data2', 5), (200, 'drg21_bandwidth:/data1', 3), (201, 'drg21_bandwidth:/data2', 3), (202, 'drg21_storage:/data1', 5), (203, 'drg21_storage:/data2', 5), (204, 'drg22_bandwidth:/data1', 3), (205, 'drg22_bandwidth:/data2', 3), (206, 'drg22_storage:/data1', 5), (207, 'drg22_storage:/data2', 5), (208, 'drg23_bandwidth:/data1', 3), (209, 'drg23_bandwidth:/data2', 3), (210, 'drg23_storage:/data1', 5), (211, 'drg23_storage:/data2', 5), (212, 'CS001rcu', 2), (213, 'CS001tbb', 1), (214, 'CS002rcu', 2), (215, 'CS002tbb', 1), (216, 'CS003rcu', 2), (217, 'CS003tbb', 1), (218, 'CS004rcu', 2), (219, 'CS004tbb', 1), (220, 'CS005rcu', 2), (221, 'CS005tbb', 1), (222, 'CS006rcu', 2), (223, 'CS006tbb', 1), (224, 'CS007rcu', 2), (225, 'CS007tbb', 1), (226, 'CS011rcu', 2), (227, 'CS011tbb', 1), (228, 'CS013rcu', 2), (229, 'CS013tbb', 1), (230, 'CS017rcu', 2), (231, 'CS017tbb', 1), (232, 'CS021rcu', 2), (233, 'CS021tbb', 1), (234, 'CS024rcu', 2), (235, 'CS024tbb', 1), (236, 'CS026rcu', 2), (237, 'CS026tbb', 1), (238, 'CS028rcu', 2), (239, 'CS028tbb', 1), (240, 'CS030rcu', 2), (241, 'CS030tbb', 1), (242, 'CS031rcu', 2), (243, 'CS031tbb', 1), (244, 'CS032rcu', 2), (245, 'CS032tbb', 1), (246, 'CS101rcu', 2), (247, 'CS101tbb', 1), (248, 'CS103rcu', 2), (249, 'CS103tbb', 1), (250, 'CS201rcu', 2), (251, 'CS201tbb', 1), (252, 'CS301rcu', 2), (253, 'CS301tbb', 1), (254, 'CS302rcu', 2), (255, 'CS302tbb', 1), (256, 'CS401rcu', 2), (257, 'CS401tbb', 1), (258, 'CS501rcu', 2), (259, 'CS501tbb', 1), (260, 'RS106rcu', 2), (261, 'RS106tbb', 1), (262, 'RS205rcu', 2), (263, 'RS205tbb', 1), (264, 'RS208rcu', 2), (265, 'RS208tbb', 1), (266, 'RS210rcu', 2), (267, 'RS210tbb', 1), (268, 'RS305rcu', 2), (269, 'RS305tbb', 1), (270, 'RS306rcu', 2), (271, 'RS306tbb', 1), (272, 'RS307rcu', 2), (273, 'RS307tbb', 1), (274, 'RS310rcu', 2), (275, 'RS310tbb', 1), (276, 'RS406rcu', 2), (277, 'RS406tbb', 1), (278, 'RS407rcu', 2), (279, 'RS407tbb', 1), (280, 'RS408rcu', 2), (281, 'RS408tbb', 1), (282, 'RS409rcu', 2), (283, 'RS409tbb', 1), (284, 'RS503rcu', 2), (285, 'RS503tbb', 1), (286, 'RS508rcu', 2), (287, 'RS508tbb', 1), (288, 'RS509rcu', 2), (289, 'RS509tbb', 1), (290, 'DE601rcu', 2), (291, 'DE601tbb', 1), (292, 'DE602rcu', 2), (293, 'DE602tbb', 1), (294, 'DE603rcu', 2), (295, 'DE603tbb', 1), (296, 'DE604rcu', 2), (297, 'DE604tbb', 1), (298, 'DE605rcu', 2), (299, 'DE605tbb', 1), (300, 'FR606rcu', 2), (301, 'FR606tbb', 1), (302, 'SE607rcu', 2), (303, 'SE607tbb', 1), (304, 'UK608rcu', 2), (305, 'UK608tbb', 1), (306, 'DE609rcu', 2), (307, 'DE609tbb', 1), (308, 'PL610rcu', 2), (309, 'PL610tbb', 1), (310, 'PL611rcu', 2), (311, 'PL611tbb', 1), (312, 'PL612rcu', 2), (313, 'PL612tbb', 1), (314, 'IE613rcu', 2), (315, 'IE613tbb', 1), (316, 'IS614rcu', 2), (317, 'IS614tbb', 1), (318, 'TEST1rcu', 2), (319, 'TEST1tbb', 1), (320, 'CS001chan0', 0), (321, 'CS001bw0', 3), (322, 'CS001chan1', 0), (323, 'CS001bw1', 3), (324, 'CS002chan0', 0), (325, 'CS002bw0', 3), (326, 'CS002chan1', 0), (327, 'CS002bw1', 3), (328, 'CS003chan0', 0), (329, 'CS003bw0', 3), (330, 'CS003chan1', 0), (331, 'CS003bw1', 3), (332, 'CS004chan0', 0), (333, 'CS004bw0', 3), (334, 'CS004chan1', 0), (335, 'CS004bw1', 3), (336, 'CS005chan0', 0), (337, 'CS005bw0', 3), (338, 'CS005chan1', 0), (339, 'CS005bw1', 3), (340, 'CS006chan0', 0), (341, 'CS006bw0', 3), (342, 'CS006chan1', 0), (343, 'CS006bw1', 3), (344, 'CS007chan0', 0), (345, 'CS007bw0', 3), (346, 'CS007chan1', 0), (347, 'CS007bw1', 3), (348, 'CS011chan0', 0), (349, 'CS011bw0', 3), (350, 'CS011chan1', 0), (351, 'CS011bw1', 3), (352, 'CS013chan0', 0), (353, 'CS013bw0', 3), (354, 'CS013chan1', 0), (355, 'CS013bw1', 3), (356, 'CS017chan0', 0), (357, 'CS017bw0', 3), (358, 'CS017chan1', 0), (359, 'CS017bw1', 3), (360, 'CS021chan0', 0), (361, 'CS021bw0', 3), (362, 'CS021chan1', 0), (363, 'CS021bw1', 3), (364, 'CS024chan0', 0), (365, 'CS024bw0', 3), (366, 'CS024chan1', 0), (367, 'CS024bw1', 3), (368, 'CS026chan0', 0), (369, 'CS026bw0', 3), (370, 'CS026chan1', 0), (371, 'CS026bw1', 3), (372, 'CS028chan0', 0), (373, 'CS028bw0', 3), (374, 'CS028chan1', 0), (375, 'CS028bw1', 3), (376, 'CS030chan0', 0), (377, 'CS030bw0', 3), (378, 'CS030chan1', 0), (379, 'CS030bw1', 3), (380, 'CS031chan0', 0), (381, 'CS031bw0', 3), (382, 'CS031chan1', 0), (383, 'CS031bw1', 3), (384, 'CS032chan0', 0), (385, 'CS032bw0', 3), (386, 'CS032chan1', 0), (387, 'CS032bw1', 3), (388, 'CS101chan0', 0), (389, 'CS101bw0', 3), (390, 'CS101chan1', 0), (391, 'CS101bw1', 3), (392, 'CS103chan0', 0), (393, 'CS103bw0', 3), (394, 'CS103chan1', 0), (395, 'CS103bw1', 3), (396, 'CS201chan0', 0), (397, 'CS201bw0', 3), (398, 'CS201chan1', 0), (399, 'CS201bw1', 3), (400, 'CS301chan0', 0), (401, 'CS301bw0', 3), (402, 'CS301chan1', 0), (403, 'CS301bw1', 3), (404, 'CS302chan0', 0), (405, 'CS302bw0', 3), (406, 'CS302chan1', 0), (407, 'CS302bw1', 3), (408, 'CS401chan0', 0), (409, 'CS401bw0', 3), (410, 'CS401chan1', 0), (411, 'CS401bw1', 3), (412, 'CS501chan0', 0), (413, 'CS501bw0', 3), (414, 'CS501chan1', 0), (415, 'CS501bw1', 3), (416, 'RS106chan', 0), (417, 'RS106bw', 3), (418, 'RS205chan', 0), (419, 'RS205bw', 3), (420, 'RS208chan', 0), (421, 'RS208bw', 3), (422, 'RS210chan', 0), (423, 'RS210bw', 3), (424, 'RS305chan', 0), (425, 'RS305bw', 3), (426, 'RS306chan', 0), (427, 'RS306bw', 3), (428, 'RS307chan', 0), (429, 'RS307bw', 3), (430, 'RS310chan', 0), (431, 'RS310bw', 3), (432, 'RS406chan', 0), (433, 'RS406bw', 3), (434, 'RS407chan', 0), (435, 'RS407bw', 3), (436, 'RS408chan', 0), (437, 'RS408bw', 3), (438, 'RS409chan', 0), (439, 'RS409bw', 3), (440, 'RS503chan', 0), (441, 'RS503bw', 3), (442, 'RS508chan', 0), (443, 'RS508bw', 3), (444, 'RS509chan', 0), (445, 'RS509bw', 3), (446, 'DE601chan', 0), (447, 'DE601bw', 3), (448, 'DE602chan', 0), (449, 'DE602bw', 3), (450, 'DE603chan', 0), (451, 'DE603bw', 3), (452, 'DE604chan', 0), (453, 'DE604bw', 3), (454, 'DE605chan', 0), (455, 'DE605bw', 3), (456, 'FR606chan', 0), (457, 'FR606bw', 3), (458, 'SE607chan', 0), (459, 'SE607bw', 3), (460, 'UK608chan', 0), (461, 'UK608bw', 3), (462, 'DE609chan', 0), (463, 'DE609bw', 3), (464, 'PL610chan', 0), (465, 'PL610bw', 3), (466, 'PL611chan', 0), (467, 'PL611bw', 3), (468, 'PL612chan', 0), (469, 'PL612bw', 3), (470, 'IE613chan', 0), (471, 'IE613bw', 3), (472, 'IS614chan', 0), (473, 'IS614bw', 3), (474, 'TEST1chan', 0), (475, 'TEST1bw', 3); +INSERT INTO virtual_instrument.resource_to_resource_group VALUES (DEFAULT, 0, 5), (DEFAULT, 1, 5), (DEFAULT, 2, 6), (DEFAULT, 3, 6), (DEFAULT, 4, 7), (DEFAULT, 5, 7), (DEFAULT, 6, 8), (DEFAULT, 7, 8), (DEFAULT, 8, 9), (DEFAULT, 9, 9), (DEFAULT, 10, 10), (DEFAULT, 11, 10), (DEFAULT, 12, 11), (DEFAULT, 13, 11), (DEFAULT, 14, 12), (DEFAULT, 15, 12), (DEFAULT, 16, 13), (DEFAULT, 17, 13), (DEFAULT, 18, 14), (DEFAULT, 19, 14), (DEFAULT, 20, 15), (DEFAULT, 21, 15), (DEFAULT, 22, 16), (DEFAULT, 23, 16), (DEFAULT, 24, 17), (DEFAULT, 25, 17), (DEFAULT, 26, 18), (DEFAULT, 27, 18), (DEFAULT, 28, 19), (DEFAULT, 29, 19), (DEFAULT, 30, 20), (DEFAULT, 31, 20), (DEFAULT, 32, 21), (DEFAULT, 33, 21), (DEFAULT, 34, 22), (DEFAULT, 35, 22), (DEFAULT, 36, 23), (DEFAULT, 37, 23), (DEFAULT, 38, 24), (DEFAULT, 39, 24), (DEFAULT, 40, 25), (DEFAULT, 41, 25), (DEFAULT, 42, 26), (DEFAULT, 43, 26), (DEFAULT, 44, 27), (DEFAULT, 45, 27), (DEFAULT, 46, 28), (DEFAULT, 47, 28), (DEFAULT, 48, 29), (DEFAULT, 49, 29), (DEFAULT, 50, 30), (DEFAULT, 51, 30), (DEFAULT, 52, 31), (DEFAULT, 53, 31), (DEFAULT, 54, 32), (DEFAULT, 55, 32), (DEFAULT, 56, 33), (DEFAULT, 57, 33), (DEFAULT, 58, 34), (DEFAULT, 59, 34), (DEFAULT, 60, 35), (DEFAULT, 61, 35), (DEFAULT, 62, 36), (DEFAULT, 63, 36), (DEFAULT, 64, 37), (DEFAULT, 65, 37), (DEFAULT, 66, 38), (DEFAULT, 67, 38), (DEFAULT, 68, 39), (DEFAULT, 69, 39), (DEFAULT, 70, 40), (DEFAULT, 71, 40), (DEFAULT, 72, 41), (DEFAULT, 73, 41), (DEFAULT, 74, 42), (DEFAULT, 75, 42), (DEFAULT, 76, 43), (DEFAULT, 77, 43), (DEFAULT, 78, 44), (DEFAULT, 79, 44), (DEFAULT, 80, 45), (DEFAULT, 81, 45), (DEFAULT, 82, 46), (DEFAULT, 83, 46), (DEFAULT, 84, 47), (DEFAULT, 85, 47), (DEFAULT, 86, 48), (DEFAULT, 87, 48), (DEFAULT, 88, 49), (DEFAULT, 89, 49), (DEFAULT, 90, 50), (DEFAULT, 91, 50), (DEFAULT, 92, 51), (DEFAULT, 93, 51), (DEFAULT, 94, 52), (DEFAULT, 95, 52), (DEFAULT, 96, 53), (DEFAULT, 97, 53), (DEFAULT, 98, 54), (DEFAULT, 99, 54), (DEFAULT, 100, 55), (DEFAULT, 101, 55), (DEFAULT, 102, 56), (DEFAULT, 103, 56), (DEFAULT, 104, 57), (DEFAULT, 105, 57), (DEFAULT, 106, 58), (DEFAULT, 107, 58), (DEFAULT, 108, 59), (DEFAULT, 109, 59), (DEFAULT, 110, 60), (DEFAULT, 111, 60), (DEFAULT, 112, 61), (DEFAULT, 113, 61), (DEFAULT, 114, 62), (DEFAULT, 115, 62), (DEFAULT, 116, 1), (DEFAULT, 117, 1), (DEFAULT, 118, 65), (DEFAULT, 119, 65), (DEFAULT, 120, 67), (DEFAULT, 121, 68), (DEFAULT, 122, 67), (DEFAULT, 123, 68), (DEFAULT, 124, 70), (DEFAULT, 125, 71), (DEFAULT, 126, 70), (DEFAULT, 127, 71), (DEFAULT, 128, 73), (DEFAULT, 129, 74), (DEFAULT, 130, 73), (DEFAULT, 131, 74), (DEFAULT, 132, 76), (DEFAULT, 133, 77), (DEFAULT, 134, 76), (DEFAULT, 135, 77), (DEFAULT, 136, 79), (DEFAULT, 137, 80), (DEFAULT, 138, 79), (DEFAULT, 139, 80), (DEFAULT, 140, 82), (DEFAULT, 141, 83), (DEFAULT, 142, 82), (DEFAULT, 143, 83), (DEFAULT, 144, 85), (DEFAULT, 145, 86), (DEFAULT, 146, 85), (DEFAULT, 147, 86), (DEFAULT, 148, 88), (DEFAULT, 149, 89), (DEFAULT, 150, 88), (DEFAULT, 151, 89), (DEFAULT, 152, 91), (DEFAULT, 153, 92), (DEFAULT, 154, 91), (DEFAULT, 155, 92), (DEFAULT, 156, 94), (DEFAULT, 157, 95), (DEFAULT, 158, 94), (DEFAULT, 159, 95), (DEFAULT, 160, 97), (DEFAULT, 161, 98), (DEFAULT, 162, 97), (DEFAULT, 163, 98), (DEFAULT, 164, 100), (DEFAULT, 165, 101), (DEFAULT, 166, 100), (DEFAULT, 167, 101), (DEFAULT, 168, 103), (DEFAULT, 169, 104), (DEFAULT, 170, 103), (DEFAULT, 171, 104), (DEFAULT, 172, 106), (DEFAULT, 173, 107), (DEFAULT, 174, 106), (DEFAULT, 175, 107), (DEFAULT, 176, 109), (DEFAULT, 177, 110), (DEFAULT, 178, 109), (DEFAULT, 179, 110), (DEFAULT, 180, 112), (DEFAULT, 181, 113), (DEFAULT, 182, 112), (DEFAULT, 183, 113), (DEFAULT, 184, 115), (DEFAULT, 185, 116), (DEFAULT, 186, 115), (DEFAULT, 187, 116), (DEFAULT, 188, 118), (DEFAULT, 189, 119), (DEFAULT, 190, 118), (DEFAULT, 191, 119), (DEFAULT, 192, 121), (DEFAULT, 193, 122), (DEFAULT, 194, 121), (DEFAULT, 195, 122), (DEFAULT, 196, 124), (DEFAULT, 197, 125), (DEFAULT, 198, 124), (DEFAULT, 199, 125), (DEFAULT, 200, 127), (DEFAULT, 201, 128), (DEFAULT, 202, 127), (DEFAULT, 203, 128), (DEFAULT, 204, 130), (DEFAULT, 205, 131), (DEFAULT, 206, 130), (DEFAULT, 207, 131), (DEFAULT, 208, 133), (DEFAULT, 209, 134), (DEFAULT, 210, 133), (DEFAULT, 211, 134), (DEFAULT, 212, 149), (DEFAULT, 213, 149), (DEFAULT, 214, 150), (DEFAULT, 215, 150), (DEFAULT, 216, 151), (DEFAULT, 217, 151), (DEFAULT, 218, 152), (DEFAULT, 219, 152), (DEFAULT, 220, 153), (DEFAULT, 221, 153), (DEFAULT, 222, 154), (DEFAULT, 223, 154), (DEFAULT, 224, 155), (DEFAULT, 225, 155), (DEFAULT, 226, 156), (DEFAULT, 227, 156), (DEFAULT, 228, 157), (DEFAULT, 229, 157), (DEFAULT, 230, 158), (DEFAULT, 231, 158), (DEFAULT, 232, 159), (DEFAULT, 233, 159), (DEFAULT, 234, 160), (DEFAULT, 235, 160), (DEFAULT, 236, 161), (DEFAULT, 237, 161), (DEFAULT, 238, 162), (DEFAULT, 239, 162), (DEFAULT, 240, 163), (DEFAULT, 241, 163), (DEFAULT, 242, 164), (DEFAULT, 243, 164), (DEFAULT, 244, 165), (DEFAULT, 245, 165), (DEFAULT, 246, 166), (DEFAULT, 247, 166), (DEFAULT, 248, 167), (DEFAULT, 249, 167), (DEFAULT, 250, 168), (DEFAULT, 251, 168), (DEFAULT, 252, 169), (DEFAULT, 253, 169), (DEFAULT, 254, 170), (DEFAULT, 255, 170), (DEFAULT, 256, 171), (DEFAULT, 257, 171), (DEFAULT, 258, 172), (DEFAULT, 259, 172), (DEFAULT, 260, 173), (DEFAULT, 261, 173), (DEFAULT, 262, 174), (DEFAULT, 263, 174), (DEFAULT, 264, 175), (DEFAULT, 265, 175), (DEFAULT, 266, 176), (DEFAULT, 267, 176), (DEFAULT, 268, 177), (DEFAULT, 269, 177), (DEFAULT, 270, 178), (DEFAULT, 271, 178), (DEFAULT, 272, 179), (DEFAULT, 273, 179), (DEFAULT, 274, 180), (DEFAULT, 275, 180), (DEFAULT, 276, 181), (DEFAULT, 277, 181), (DEFAULT, 278, 182), (DEFAULT, 279, 182), (DEFAULT, 280, 183), (DEFAULT, 281, 183), (DEFAULT, 282, 184), (DEFAULT, 283, 184), (DEFAULT, 284, 185), (DEFAULT, 285, 185), (DEFAULT, 286, 186), (DEFAULT, 287, 186), (DEFAULT, 288, 187), (DEFAULT, 289, 187), (DEFAULT, 290, 188), (DEFAULT, 291, 188), (DEFAULT, 292, 189), (DEFAULT, 293, 189), (DEFAULT, 294, 190), (DEFAULT, 295, 190), (DEFAULT, 296, 191), (DEFAULT, 297, 191), (DEFAULT, 298, 192), (DEFAULT, 299, 192), (DEFAULT, 300, 193), (DEFAULT, 301, 193), (DEFAULT, 302, 194), (DEFAULT, 303, 194), (DEFAULT, 304, 195), (DEFAULT, 305, 195), (DEFAULT, 306, 196), (DEFAULT, 307, 196), (DEFAULT, 308, 197), (DEFAULT, 309, 197), (DEFAULT, 310, 198), (DEFAULT, 311, 198), (DEFAULT, 312, 199), (DEFAULT, 313, 199), (DEFAULT, 314, 200), (DEFAULT, 315, 200), (DEFAULT, 316, 201), (DEFAULT, 317, 201), (DEFAULT, 318, 202), (DEFAULT, 319, 202), (DEFAULT, 320, 206), (DEFAULT, 321, 206), (DEFAULT, 322, 207), (DEFAULT, 323, 207), (DEFAULT, 324, 208), (DEFAULT, 325, 208), (DEFAULT, 326, 209), (DEFAULT, 327, 209), (DEFAULT, 328, 210), (DEFAULT, 329, 210), (DEFAULT, 330, 211), (DEFAULT, 331, 211), (DEFAULT, 332, 212), (DEFAULT, 333, 212), (DEFAULT, 334, 213), (DEFAULT, 335, 213), (DEFAULT, 336, 214), (DEFAULT, 337, 214), (DEFAULT, 338, 215), (DEFAULT, 339, 215), (DEFAULT, 340, 216), (DEFAULT, 341, 216), (DEFAULT, 342, 217), (DEFAULT, 343, 217), (DEFAULT, 344, 218), (DEFAULT, 345, 218), (DEFAULT, 346, 219), (DEFAULT, 347, 219), (DEFAULT, 348, 220), (DEFAULT, 349, 220), (DEFAULT, 350, 221), (DEFAULT, 351, 221), (DEFAULT, 352, 222), (DEFAULT, 353, 222), (DEFAULT, 354, 223), (DEFAULT, 355, 223), (DEFAULT, 356, 224), (DEFAULT, 357, 224), (DEFAULT, 358, 225), (DEFAULT, 359, 225), (DEFAULT, 360, 226), (DEFAULT, 361, 226), (DEFAULT, 362, 227), (DEFAULT, 363, 227), (DEFAULT, 364, 228), (DEFAULT, 365, 228), (DEFAULT, 366, 229), (DEFAULT, 367, 229), (DEFAULT, 368, 230), (DEFAULT, 369, 230), (DEFAULT, 370, 231), (DEFAULT, 371, 231), (DEFAULT, 372, 232), (DEFAULT, 373, 232), (DEFAULT, 374, 233), (DEFAULT, 375, 233), (DEFAULT, 376, 234), (DEFAULT, 377, 234), (DEFAULT, 378, 235), (DEFAULT, 379, 235), (DEFAULT, 380, 236), (DEFAULT, 381, 236), (DEFAULT, 382, 237), (DEFAULT, 383, 237), (DEFAULT, 384, 238), (DEFAULT, 385, 238), (DEFAULT, 386, 239), (DEFAULT, 387, 239), (DEFAULT, 388, 240), (DEFAULT, 389, 240), (DEFAULT, 390, 241), (DEFAULT, 391, 241), (DEFAULT, 392, 242), (DEFAULT, 393, 242), (DEFAULT, 394, 243), (DEFAULT, 395, 243), (DEFAULT, 396, 244), (DEFAULT, 397, 244), (DEFAULT, 398, 245), (DEFAULT, 399, 245), (DEFAULT, 400, 246), (DEFAULT, 401, 246), (DEFAULT, 402, 247), (DEFAULT, 403, 247), (DEFAULT, 404, 248), (DEFAULT, 405, 248), (DEFAULT, 406, 249), (DEFAULT, 407, 249), (DEFAULT, 408, 250), (DEFAULT, 409, 250), (DEFAULT, 410, 251), (DEFAULT, 411, 251), (DEFAULT, 412, 252), (DEFAULT, 413, 252), (DEFAULT, 414, 253), (DEFAULT, 415, 253), (DEFAULT, 416, 254), (DEFAULT, 417, 254), (DEFAULT, 418, 255), (DEFAULT, 419, 255), (DEFAULT, 420, 256), (DEFAULT, 421, 256), (DEFAULT, 422, 257), (DEFAULT, 423, 257), (DEFAULT, 424, 258), (DEFAULT, 425, 258), (DEFAULT, 426, 259), (DEFAULT, 427, 259), (DEFAULT, 428, 260), (DEFAULT, 429, 260), (DEFAULT, 430, 261), (DEFAULT, 431, 261), (DEFAULT, 432, 262), (DEFAULT, 433, 262), (DEFAULT, 434, 263), (DEFAULT, 435, 263), (DEFAULT, 436, 264), (DEFAULT, 437, 264), (DEFAULT, 438, 265), (DEFAULT, 439, 265), (DEFAULT, 440, 266), (DEFAULT, 441, 266), (DEFAULT, 442, 267), (DEFAULT, 443, 267), (DEFAULT, 444, 268), (DEFAULT, 445, 268), (DEFAULT, 446, 269), (DEFAULT, 447, 269), (DEFAULT, 448, 270), (DEFAULT, 449, 270), (DEFAULT, 450, 271), (DEFAULT, 451, 271), (DEFAULT, 452, 272), (DEFAULT, 453, 272), (DEFAULT, 454, 273), (DEFAULT, 455, 273), (DEFAULT, 456, 274), (DEFAULT, 457, 274), (DEFAULT, 458, 275), (DEFAULT, 459, 275), (DEFAULT, 460, 276), (DEFAULT, 461, 276), (DEFAULT, 462, 277), (DEFAULT, 463, 277), (DEFAULT, 464, 278), (DEFAULT, 465, 278), (DEFAULT, 466, 279), (DEFAULT, 467, 279), (DEFAULT, 468, 280), (DEFAULT, 469, 280), (DEFAULT, 470, 281), (DEFAULT, 471, 281), (DEFAULT, 472, 282), (DEFAULT, 473, 282), (DEFAULT, 474, 283), (DEFAULT, 475, 283); +INSERT INTO resource_monitoring.resource_capacity VALUES (DEFAULT, 0, 26000000000, 26000000000), (DEFAULT, 1, 24, 24), (DEFAULT, 2, 26000000000, 26000000000), (DEFAULT, 3, 24, 24), (DEFAULT, 4, 26000000000, 26000000000), (DEFAULT, 5, 24, 24), (DEFAULT, 6, 26000000000, 26000000000), (DEFAULT, 7, 24, 24), (DEFAULT, 8, 26000000000, 26000000000), (DEFAULT, 9, 24, 24), (DEFAULT, 10, 26000000000, 26000000000), (DEFAULT, 11, 24, 24), (DEFAULT, 12, 26000000000, 26000000000), (DEFAULT, 13, 24, 24), (DEFAULT, 14, 26000000000, 26000000000), (DEFAULT, 15, 24, 24), (DEFAULT, 16, 26000000000, 26000000000), (DEFAULT, 17, 24, 24), (DEFAULT, 18, 26000000000, 26000000000), (DEFAULT, 19, 24, 24), (DEFAULT, 20, 26000000000, 26000000000), (DEFAULT, 21, 24, 24), (DEFAULT, 22, 26000000000, 26000000000), (DEFAULT, 23, 24, 24), (DEFAULT, 24, 26000000000, 26000000000), (DEFAULT, 25, 24, 24), (DEFAULT, 26, 26000000000, 26000000000), (DEFAULT, 27, 24, 24), (DEFAULT, 28, 26000000000, 26000000000), (DEFAULT, 29, 24, 24), (DEFAULT, 30, 26000000000, 26000000000), (DEFAULT, 31, 24, 24), (DEFAULT, 32, 26000000000, 26000000000), (DEFAULT, 33, 24, 24), (DEFAULT, 34, 26000000000, 26000000000), (DEFAULT, 35, 24, 24), (DEFAULT, 36, 26000000000, 26000000000), (DEFAULT, 37, 24, 24), (DEFAULT, 38, 26000000000, 26000000000), (DEFAULT, 39, 24, 24), (DEFAULT, 40, 26000000000, 26000000000), (DEFAULT, 41, 24, 24), (DEFAULT, 42, 26000000000, 26000000000), (DEFAULT, 43, 24, 24), (DEFAULT, 44, 26000000000, 26000000000), (DEFAULT, 45, 24, 24), (DEFAULT, 46, 26000000000, 26000000000), (DEFAULT, 47, 24, 24), (DEFAULT, 48, 26000000000, 26000000000), (DEFAULT, 49, 24, 24), (DEFAULT, 50, 26000000000, 26000000000), (DEFAULT, 51, 24, 24), (DEFAULT, 52, 26000000000, 26000000000), (DEFAULT, 53, 24, 24), (DEFAULT, 54, 26000000000, 26000000000), (DEFAULT, 55, 24, 24), (DEFAULT, 56, 26000000000, 26000000000), (DEFAULT, 57, 24, 24), (DEFAULT, 58, 26000000000, 26000000000), (DEFAULT, 59, 24, 24), (DEFAULT, 60, 26000000000, 26000000000), (DEFAULT, 61, 24, 24), (DEFAULT, 62, 26000000000, 26000000000), (DEFAULT, 63, 24, 24), (DEFAULT, 64, 26000000000, 26000000000), (DEFAULT, 65, 24, 24), (DEFAULT, 66, 26000000000, 26000000000), (DEFAULT, 67, 24, 24), (DEFAULT, 68, 26000000000, 26000000000), (DEFAULT, 69, 24, 24), (DEFAULT, 70, 26000000000, 26000000000), (DEFAULT, 71, 24, 24), (DEFAULT, 72, 26000000000, 26000000000), (DEFAULT, 73, 24, 24), (DEFAULT, 74, 26000000000, 26000000000), (DEFAULT, 75, 24, 24), (DEFAULT, 76, 26000000000, 26000000000), (DEFAULT, 77, 24, 24), (DEFAULT, 78, 26000000000, 26000000000), (DEFAULT, 79, 24, 24), (DEFAULT, 80, 26000000000, 26000000000), (DEFAULT, 81, 24, 24), (DEFAULT, 82, 26000000000, 26000000000), (DEFAULT, 83, 24, 24), (DEFAULT, 84, 26000000000, 26000000000), (DEFAULT, 85, 24, 24), (DEFAULT, 86, 26000000000, 26000000000), (DEFAULT, 87, 24, 24), (DEFAULT, 88, 26000000000, 26000000000), (DEFAULT, 89, 24, 24), (DEFAULT, 90, 26000000000, 26000000000), (DEFAULT, 91, 24, 24), (DEFAULT, 92, 26000000000, 26000000000), (DEFAULT, 93, 24, 24), (DEFAULT, 94, 26000000000, 26000000000), (DEFAULT, 95, 24, 24), (DEFAULT, 96, 26000000000, 26000000000), (DEFAULT, 97, 24, 24), (DEFAULT, 98, 26000000000, 26000000000), (DEFAULT, 99, 24, 24), (DEFAULT, 100, 52000000000, 52000000000), (DEFAULT, 101, 24, 24), (DEFAULT, 102, 52000000000, 52000000000), (DEFAULT, 103, 24, 24), (DEFAULT, 104, 52000000000, 52000000000), (DEFAULT, 105, 24, 24), (DEFAULT, 106, 52000000000, 52000000000), (DEFAULT, 107, 24, 24), (DEFAULT, 108, 52000000000, 52000000000), (DEFAULT, 109, 24, 24), (DEFAULT, 110, 52000000000, 52000000000), (DEFAULT, 111, 24, 24), (DEFAULT, 112, 52000000000, 52000000000), (DEFAULT, 113, 24, 24), (DEFAULT, 114, 52000000000, 52000000000), (DEFAULT, 115, 24, 24), (DEFAULT, 116, 687194767360, 687194767360), (DEFAULT, 117, 3450434462023680, 3450434462023680), (DEFAULT, 118, 3774873600, 3774873600), (DEFAULT, 119, 23669957984256, 23669957984256), (DEFAULT, 120, 2030043136, 2030043136), (DEFAULT, 121, 2030043136, 2030043136), (DEFAULT, 122, 7913168961536, 7913168961536), (DEFAULT, 123, 7913168961536, 7913168961536), (DEFAULT, 124, 2030043136, 2030043136), (DEFAULT, 125, 2030043136, 2030043136), (DEFAULT, 126, 7913168961536, 7913168961536), (DEFAULT, 127, 7913168961536, 7913168961536), (DEFAULT, 128, 2030043136, 2030043136), (DEFAULT, 129, 2030043136, 2030043136), (DEFAULT, 130, 7913168961536, 7913168961536), (DEFAULT, 131, 7913168961536, 7913168961536), (DEFAULT, 132, 2030043136, 2030043136), (DEFAULT, 133, 2030043136, 2030043136), (DEFAULT, 134, 7913168961536, 7913168961536), (DEFAULT, 135, 7913168961536, 7913168961536), (DEFAULT, 136, 2030043136, 2030043136), (DEFAULT, 137, 2030043136, 2030043136), (DEFAULT, 138, 7913168961536, 7913168961536), (DEFAULT, 139, 7913168961536, 7913168961536), (DEFAULT, 140, 2030043136, 2030043136), (DEFAULT, 141, 2030043136, 2030043136), (DEFAULT, 142, 7913168961536, 7913168961536), (DEFAULT, 143, 7913168961536, 7913168961536), (DEFAULT, 144, 2030043136, 2030043136), (DEFAULT, 145, 2030043136, 2030043136), (DEFAULT, 146, 7913168961536, 7913168961536), (DEFAULT, 147, 7913168961536, 7913168961536), (DEFAULT, 148, 2030043136, 2030043136), (DEFAULT, 149, 2030043136, 2030043136), (DEFAULT, 150, 7913168961536, 7913168961536), (DEFAULT, 151, 7913168961536, 7913168961536), (DEFAULT, 152, 2030043136, 2030043136), (DEFAULT, 153, 2030043136, 2030043136), (DEFAULT, 154, 7913168961536, 7913168961536), (DEFAULT, 155, 7913168961536, 7913168961536), (DEFAULT, 156, 2030043136, 2030043136), (DEFAULT, 157, 2030043136, 2030043136), (DEFAULT, 158, 7913168961536, 7913168961536), (DEFAULT, 159, 7913168961536, 7913168961536), (DEFAULT, 160, 2030043136, 2030043136), (DEFAULT, 161, 2030043136, 2030043136), (DEFAULT, 162, 7913168961536, 7913168961536), (DEFAULT, 163, 7913168961536, 7913168961536), (DEFAULT, 164, 2030043136, 2030043136), (DEFAULT, 165, 2030043136, 2030043136), (DEFAULT, 166, 7913168961536, 7913168961536), (DEFAULT, 167, 7913168961536, 7913168961536), (DEFAULT, 168, 2030043136, 2030043136), (DEFAULT, 169, 2030043136, 2030043136), (DEFAULT, 170, 7913168961536, 7913168961536), (DEFAULT, 171, 7913168961536, 7913168961536), (DEFAULT, 172, 2030043136, 2030043136), (DEFAULT, 173, 2030043136, 2030043136), (DEFAULT, 174, 7913168961536, 7913168961536), (DEFAULT, 175, 7913168961536, 7913168961536), (DEFAULT, 176, 2030043136, 2030043136), (DEFAULT, 177, 2030043136, 2030043136), (DEFAULT, 178, 7913168961536, 7913168961536), (DEFAULT, 179, 7913168961536, 7913168961536), (DEFAULT, 180, 2030043136, 2030043136), (DEFAULT, 181, 2030043136, 2030043136), (DEFAULT, 182, 7913168961536, 7913168961536), (DEFAULT, 183, 7913168961536, 7913168961536), (DEFAULT, 184, 2030043136, 2030043136), (DEFAULT, 185, 2030043136, 2030043136), (DEFAULT, 186, 7913168961536, 7913168961536), (DEFAULT, 187, 7913168961536, 7913168961536), (DEFAULT, 188, 2030043136, 2030043136), (DEFAULT, 189, 2030043136, 2030043136), (DEFAULT, 190, 7913168961536, 7913168961536), (DEFAULT, 191, 7913168961536, 7913168961536), (DEFAULT, 192, 2030043136, 2030043136), (DEFAULT, 193, 2030043136, 2030043136), (DEFAULT, 194, 7913168961536, 7913168961536), (DEFAULT, 195, 7913168961536, 7913168961536), (DEFAULT, 196, 2030043136, 2030043136), (DEFAULT, 197, 2030043136, 2030043136), (DEFAULT, 198, 7913168961536, 7913168961536), (DEFAULT, 199, 7913168961536, 7913168961536), (DEFAULT, 200, 2030043136, 2030043136), (DEFAULT, 201, 2030043136, 2030043136), (DEFAULT, 202, 7913168961536, 7913168961536), (DEFAULT, 203, 7913168961536, 7913168961536), (DEFAULT, 204, 2030043136, 2030043136), (DEFAULT, 205, 2030043136, 2030043136), (DEFAULT, 206, 7913168961536, 7913168961536), (DEFAULT, 207, 7913168961536, 7913168961536), (DEFAULT, 208, 2030043136, 2030043136), (DEFAULT, 209, 2030043136, 2030043136), (DEFAULT, 210, 7913168961536, 7913168961536), (DEFAULT, 211, 7913168961536, 7913168961536), (DEFAULT, 212, 96, 96), (DEFAULT, 213, 824633720832, 824633720832), (DEFAULT, 214, 96, 96), (DEFAULT, 215, 824633720832, 824633720832), (DEFAULT, 216, 96, 96), (DEFAULT, 217, 824633720832, 824633720832), (DEFAULT, 218, 96, 96), (DEFAULT, 219, 824633720832, 824633720832), (DEFAULT, 220, 96, 96), (DEFAULT, 221, 824633720832, 824633720832), (DEFAULT, 222, 96, 96), (DEFAULT, 223, 824633720832, 824633720832), (DEFAULT, 224, 96, 96), (DEFAULT, 225, 824633720832, 824633720832), (DEFAULT, 226, 96, 96), (DEFAULT, 227, 824633720832, 824633720832), (DEFAULT, 228, 96, 96), (DEFAULT, 229, 824633720832, 824633720832), (DEFAULT, 230, 96, 96), (DEFAULT, 231, 824633720832, 824633720832), (DEFAULT, 232, 96, 96), (DEFAULT, 233, 824633720832, 824633720832), (DEFAULT, 234, 96, 96), (DEFAULT, 235, 824633720832, 824633720832), (DEFAULT, 236, 96, 96), (DEFAULT, 237, 824633720832, 824633720832), (DEFAULT, 238, 96, 96), (DEFAULT, 239, 824633720832, 824633720832), (DEFAULT, 240, 96, 96), (DEFAULT, 241, 824633720832, 824633720832), (DEFAULT, 242, 96, 96), (DEFAULT, 243, 824633720832, 824633720832), (DEFAULT, 244, 96, 96), (DEFAULT, 245, 824633720832, 824633720832), (DEFAULT, 246, 96, 96), (DEFAULT, 247, 824633720832, 824633720832), (DEFAULT, 248, 96, 96), (DEFAULT, 249, 824633720832, 824633720832), (DEFAULT, 250, 96, 96), (DEFAULT, 251, 824633720832, 824633720832), (DEFAULT, 252, 96, 96), (DEFAULT, 253, 824633720832, 824633720832), (DEFAULT, 254, 96, 96), (DEFAULT, 255, 824633720832, 824633720832), (DEFAULT, 256, 96, 96), (DEFAULT, 257, 824633720832, 824633720832), (DEFAULT, 258, 96, 96), (DEFAULT, 259, 824633720832, 824633720832), (DEFAULT, 260, 96, 96), (DEFAULT, 261, 824633720832, 824633720832), (DEFAULT, 262, 96, 96), (DEFAULT, 263, 824633720832, 824633720832), (DEFAULT, 264, 96, 96), (DEFAULT, 265, 824633720832, 824633720832), (DEFAULT, 266, 96, 96), (DEFAULT, 267, 824633720832, 824633720832), (DEFAULT, 268, 96, 96), (DEFAULT, 269, 824633720832, 824633720832), (DEFAULT, 270, 96, 96), (DEFAULT, 271, 824633720832, 824633720832), (DEFAULT, 272, 96, 96), (DEFAULT, 273, 824633720832, 824633720832), (DEFAULT, 274, 96, 96), (DEFAULT, 275, 824633720832, 824633720832), (DEFAULT, 276, 96, 96), (DEFAULT, 277, 824633720832, 824633720832), (DEFAULT, 278, 96, 96), (DEFAULT, 279, 824633720832, 824633720832), (DEFAULT, 280, 96, 96), (DEFAULT, 281, 824633720832, 824633720832), (DEFAULT, 282, 96, 96), (DEFAULT, 283, 824633720832, 824633720832), (DEFAULT, 284, 96, 96), (DEFAULT, 285, 824633720832, 824633720832), (DEFAULT, 286, 96, 96), (DEFAULT, 287, 824633720832, 824633720832), (DEFAULT, 288, 96, 96), (DEFAULT, 289, 824633720832, 824633720832), (DEFAULT, 290, 192, 192), (DEFAULT, 291, 1649267441664, 1649267441664), (DEFAULT, 292, 192, 192), (DEFAULT, 293, 1649267441664, 1649267441664), (DEFAULT, 294, 192, 192), (DEFAULT, 295, 1649267441664, 1649267441664), (DEFAULT, 296, 192, 192), (DEFAULT, 297, 1649267441664, 1649267441664), (DEFAULT, 298, 192, 192), (DEFAULT, 299, 1649267441664, 1649267441664), (DEFAULT, 300, 192, 192), (DEFAULT, 301, 1649267441664, 1649267441664), (DEFAULT, 302, 192, 192), (DEFAULT, 303, 1649267441664, 1649267441664), (DEFAULT, 304, 192, 192), (DEFAULT, 305, 1649267441664, 1649267441664), (DEFAULT, 306, 192, 192), (DEFAULT, 307, 1649267441664, 1649267441664), (DEFAULT, 308, 192, 192), (DEFAULT, 309, 1649267441664, 1649267441664), (DEFAULT, 310, 192, 192), (DEFAULT, 311, 1649267441664, 1649267441664), (DEFAULT, 312, 192, 192), (DEFAULT, 313, 1649267441664, 1649267441664), (DEFAULT, 314, 192, 192), (DEFAULT, 315, 1649267441664, 1649267441664), (DEFAULT, 316, 192, 192), (DEFAULT, 317, 1649267441664, 1649267441664), (DEFAULT, 318, 192, 192), (DEFAULT, 319, 1649267441664, 1649267441664), (DEFAULT, 320, 976, 976), (DEFAULT, 321, 3000000000, 3000000000), (DEFAULT, 322, 976, 976), (DEFAULT, 323, 3000000000, 3000000000), (DEFAULT, 324, 976, 976), (DEFAULT, 325, 3000000000, 3000000000), (DEFAULT, 326, 976, 976), (DEFAULT, 327, 3000000000, 3000000000), (DEFAULT, 328, 976, 976), (DEFAULT, 329, 3000000000, 3000000000), (DEFAULT, 330, 976, 976), (DEFAULT, 331, 3000000000, 3000000000), (DEFAULT, 332, 976, 976), (DEFAULT, 333, 3000000000, 3000000000), (DEFAULT, 334, 976, 976), (DEFAULT, 335, 3000000000, 3000000000), (DEFAULT, 336, 976, 976), (DEFAULT, 337, 3000000000, 3000000000), (DEFAULT, 338, 976, 976), (DEFAULT, 339, 3000000000, 3000000000), (DEFAULT, 340, 976, 976), (DEFAULT, 341, 3000000000, 3000000000), (DEFAULT, 342, 976, 976), (DEFAULT, 343, 3000000000, 3000000000), (DEFAULT, 344, 976, 976), (DEFAULT, 345, 3000000000, 3000000000), (DEFAULT, 346, 976, 976), (DEFAULT, 347, 3000000000, 3000000000), (DEFAULT, 348, 976, 976), (DEFAULT, 349, 3000000000, 3000000000), (DEFAULT, 350, 976, 976), (DEFAULT, 351, 3000000000, 3000000000), (DEFAULT, 352, 976, 976), (DEFAULT, 353, 3000000000, 3000000000), (DEFAULT, 354, 976, 976), (DEFAULT, 355, 3000000000, 3000000000), (DEFAULT, 356, 976, 976), (DEFAULT, 357, 3000000000, 3000000000), (DEFAULT, 358, 976, 976), (DEFAULT, 359, 3000000000, 3000000000), (DEFAULT, 360, 976, 976), (DEFAULT, 361, 3000000000, 3000000000), (DEFAULT, 362, 976, 976), (DEFAULT, 363, 3000000000, 3000000000), (DEFAULT, 364, 976, 976), (DEFAULT, 365, 3000000000, 3000000000), (DEFAULT, 366, 976, 976), (DEFAULT, 367, 3000000000, 3000000000), (DEFAULT, 368, 976, 976), (DEFAULT, 369, 3000000000, 3000000000), (DEFAULT, 370, 976, 976), (DEFAULT, 371, 3000000000, 3000000000), (DEFAULT, 372, 976, 976), (DEFAULT, 373, 3000000000, 3000000000), (DEFAULT, 374, 976, 976), (DEFAULT, 375, 3000000000, 3000000000), (DEFAULT, 376, 976, 976), (DEFAULT, 377, 3000000000, 3000000000), (DEFAULT, 378, 976, 976), (DEFAULT, 379, 3000000000, 3000000000), (DEFAULT, 380, 976, 976), (DEFAULT, 381, 3000000000, 3000000000), (DEFAULT, 382, 976, 976), (DEFAULT, 383, 3000000000, 3000000000), (DEFAULT, 384, 976, 976), (DEFAULT, 385, 3000000000, 3000000000), (DEFAULT, 386, 976, 976), (DEFAULT, 387, 3000000000, 3000000000), (DEFAULT, 388, 976, 976), (DEFAULT, 389, 3000000000, 3000000000), (DEFAULT, 390, 976, 976), (DEFAULT, 391, 3000000000, 3000000000), (DEFAULT, 392, 976, 976), (DEFAULT, 393, 3000000000, 3000000000), (DEFAULT, 394, 976, 976), (DEFAULT, 395, 3000000000, 3000000000), (DEFAULT, 396, 976, 976), (DEFAULT, 397, 3000000000, 3000000000), (DEFAULT, 398, 976, 976), (DEFAULT, 399, 3000000000, 3000000000), (DEFAULT, 400, 976, 976), (DEFAULT, 401, 3000000000, 3000000000), (DEFAULT, 402, 976, 976), (DEFAULT, 403, 3000000000, 3000000000), (DEFAULT, 404, 976, 976), (DEFAULT, 405, 3000000000, 3000000000), (DEFAULT, 406, 976, 976), (DEFAULT, 407, 3000000000, 3000000000), (DEFAULT, 408, 976, 976), (DEFAULT, 409, 3000000000, 3000000000), (DEFAULT, 410, 976, 976), (DEFAULT, 411, 3000000000, 3000000000), (DEFAULT, 412, 976, 976), (DEFAULT, 413, 3000000000, 3000000000), (DEFAULT, 414, 976, 976), (DEFAULT, 415, 3000000000, 3000000000), (DEFAULT, 416, 976, 976), (DEFAULT, 417, 3000000000, 3000000000), (DEFAULT, 418, 976, 976), (DEFAULT, 419, 3000000000, 3000000000), (DEFAULT, 420, 976, 976), (DEFAULT, 421, 3000000000, 3000000000), (DEFAULT, 422, 976, 976), (DEFAULT, 423, 3000000000, 3000000000), (DEFAULT, 424, 976, 976), (DEFAULT, 425, 3000000000, 3000000000), (DEFAULT, 426, 976, 976), (DEFAULT, 427, 3000000000, 3000000000), (DEFAULT, 428, 976, 976), (DEFAULT, 429, 3000000000, 3000000000), (DEFAULT, 430, 976, 976), (DEFAULT, 431, 3000000000, 3000000000), (DEFAULT, 432, 976, 976), (DEFAULT, 433, 3000000000, 3000000000), (DEFAULT, 434, 976, 976), (DEFAULT, 435, 3000000000, 3000000000), (DEFAULT, 436, 976, 976), (DEFAULT, 437, 3000000000, 3000000000), (DEFAULT, 438, 976, 976), (DEFAULT, 439, 3000000000, 3000000000), (DEFAULT, 440, 976, 976), (DEFAULT, 441, 3000000000, 3000000000), (DEFAULT, 442, 976, 976), (DEFAULT, 443, 3000000000, 3000000000), (DEFAULT, 444, 976, 976), (DEFAULT, 445, 3000000000, 3000000000), (DEFAULT, 446, 976, 976), (DEFAULT, 447, 3000000000, 3000000000), (DEFAULT, 448, 976, 976), (DEFAULT, 449, 3000000000, 3000000000), (DEFAULT, 450, 976, 976), (DEFAULT, 451, 3000000000, 3000000000), (DEFAULT, 452, 976, 976), (DEFAULT, 453, 3000000000, 3000000000), (DEFAULT, 454, 976, 976), (DEFAULT, 455, 3000000000, 3000000000), (DEFAULT, 456, 976, 976), (DEFAULT, 457, 3000000000, 3000000000), (DEFAULT, 458, 976, 976), (DEFAULT, 459, 3000000000, 3000000000), (DEFAULT, 460, 976, 976), (DEFAULT, 461, 3000000000, 3000000000), (DEFAULT, 462, 976, 976), (DEFAULT, 463, 3000000000, 3000000000), (DEFAULT, 464, 976, 976), (DEFAULT, 465, 3000000000, 3000000000), (DEFAULT, 466, 976, 976), (DEFAULT, 467, 3000000000, 3000000000), (DEFAULT, 468, 976, 976), (DEFAULT, 469, 3000000000, 3000000000), (DEFAULT, 470, 976, 976), (DEFAULT, 471, 3000000000, 3000000000), (DEFAULT, 472, 976, 976), (DEFAULT, 473, 3000000000, 3000000000), (DEFAULT, 474, 976, 976), (DEFAULT, 475, 3000000000, 3000000000); +INSERT INTO resource_monitoring.resource_availability VALUES (DEFAULT, 0, TRUE), (DEFAULT, 1, TRUE), (DEFAULT, 2, TRUE), (DEFAULT, 3, TRUE), (DEFAULT, 4, TRUE), (DEFAULT, 5, TRUE), (DEFAULT, 6, TRUE), (DEFAULT, 7, TRUE), (DEFAULT, 8, TRUE), (DEFAULT, 9, TRUE), (DEFAULT, 10, TRUE), (DEFAULT, 11, TRUE), (DEFAULT, 12, TRUE), (DEFAULT, 13, TRUE), (DEFAULT, 14, TRUE), (DEFAULT, 15, TRUE), (DEFAULT, 16, TRUE), (DEFAULT, 17, TRUE), (DEFAULT, 18, TRUE), (DEFAULT, 19, TRUE), (DEFAULT, 20, TRUE), (DEFAULT, 21, TRUE), (DEFAULT, 22, TRUE), (DEFAULT, 23, TRUE), (DEFAULT, 24, TRUE), (DEFAULT, 25, TRUE), (DEFAULT, 26, TRUE), (DEFAULT, 27, TRUE), (DEFAULT, 28, TRUE), (DEFAULT, 29, TRUE), (DEFAULT, 30, TRUE), (DEFAULT, 31, TRUE), (DEFAULT, 32, TRUE), (DEFAULT, 33, TRUE), (DEFAULT, 34, TRUE), (DEFAULT, 35, TRUE), (DEFAULT, 36, TRUE), (DEFAULT, 37, TRUE), (DEFAULT, 38, TRUE), (DEFAULT, 39, TRUE), (DEFAULT, 40, TRUE), (DEFAULT, 41, TRUE), (DEFAULT, 42, TRUE), (DEFAULT, 43, TRUE), (DEFAULT, 44, TRUE), (DEFAULT, 45, TRUE), (DEFAULT, 46, TRUE), (DEFAULT, 47, TRUE), (DEFAULT, 48, TRUE), (DEFAULT, 49, TRUE), (DEFAULT, 50, TRUE), (DEFAULT, 51, TRUE), (DEFAULT, 52, TRUE), (DEFAULT, 53, TRUE), (DEFAULT, 54, TRUE), (DEFAULT, 55, TRUE), (DEFAULT, 56, TRUE), (DEFAULT, 57, TRUE), (DEFAULT, 58, TRUE), (DEFAULT, 59, TRUE), (DEFAULT, 60, TRUE), (DEFAULT, 61, TRUE), (DEFAULT, 62, TRUE), (DEFAULT, 63, TRUE), (DEFAULT, 64, TRUE), (DEFAULT, 65, TRUE), (DEFAULT, 66, TRUE), (DEFAULT, 67, TRUE), (DEFAULT, 68, TRUE), (DEFAULT, 69, TRUE), (DEFAULT, 70, TRUE), (DEFAULT, 71, TRUE), (DEFAULT, 72, TRUE), (DEFAULT, 73, TRUE), (DEFAULT, 74, TRUE), (DEFAULT, 75, TRUE), (DEFAULT, 76, TRUE), (DEFAULT, 77, TRUE), (DEFAULT, 78, TRUE), (DEFAULT, 79, TRUE), (DEFAULT, 80, TRUE), (DEFAULT, 81, TRUE), (DEFAULT, 82, TRUE), (DEFAULT, 83, TRUE), (DEFAULT, 84, TRUE), (DEFAULT, 85, TRUE), (DEFAULT, 86, TRUE), (DEFAULT, 87, TRUE), (DEFAULT, 88, TRUE), (DEFAULT, 89, TRUE), (DEFAULT, 90, TRUE), (DEFAULT, 91, TRUE), (DEFAULT, 92, TRUE), (DEFAULT, 93, TRUE), (DEFAULT, 94, TRUE), (DEFAULT, 95, TRUE), (DEFAULT, 96, TRUE), (DEFAULT, 97, TRUE), (DEFAULT, 98, TRUE), (DEFAULT, 99, TRUE), (DEFAULT, 100, TRUE), (DEFAULT, 101, TRUE), (DEFAULT, 102, TRUE), (DEFAULT, 103, TRUE), (DEFAULT, 104, TRUE), (DEFAULT, 105, TRUE), (DEFAULT, 106, TRUE), (DEFAULT, 107, TRUE), (DEFAULT, 108, TRUE), (DEFAULT, 109, TRUE), (DEFAULT, 110, TRUE), (DEFAULT, 111, TRUE), (DEFAULT, 112, TRUE), (DEFAULT, 113, TRUE), (DEFAULT, 114, TRUE), (DEFAULT, 115, TRUE), (DEFAULT, 116, TRUE), (DEFAULT, 117, TRUE), (DEFAULT, 118, TRUE), (DEFAULT, 119, FALSE), (DEFAULT, 120, TRUE), (DEFAULT, 121, TRUE), (DEFAULT, 122, TRUE), (DEFAULT, 123, TRUE), (DEFAULT, 124, TRUE), (DEFAULT, 125, TRUE), (DEFAULT, 126, TRUE), (DEFAULT, 127, TRUE), (DEFAULT, 128, TRUE), (DEFAULT, 129, TRUE), (DEFAULT, 130, TRUE), (DEFAULT, 131, TRUE), (DEFAULT, 132, TRUE), (DEFAULT, 133, TRUE), (DEFAULT, 134, TRUE), (DEFAULT, 135, TRUE), (DEFAULT, 136, TRUE), (DEFAULT, 137, TRUE), (DEFAULT, 138, TRUE), (DEFAULT, 139, TRUE), (DEFAULT, 140, TRUE), (DEFAULT, 141, TRUE), (DEFAULT, 142, TRUE), (DEFAULT, 143, TRUE), (DEFAULT, 144, TRUE), (DEFAULT, 145, TRUE), (DEFAULT, 146, TRUE), (DEFAULT, 147, TRUE), (DEFAULT, 148, TRUE), (DEFAULT, 149, TRUE), (DEFAULT, 150, TRUE), (DEFAULT, 151, TRUE), (DEFAULT, 152, TRUE), (DEFAULT, 153, TRUE), (DEFAULT, 154, TRUE), (DEFAULT, 155, TRUE), (DEFAULT, 156, TRUE), (DEFAULT, 157, TRUE), (DEFAULT, 158, TRUE), (DEFAULT, 159, TRUE), (DEFAULT, 160, TRUE), (DEFAULT, 161, TRUE), (DEFAULT, 162, TRUE), (DEFAULT, 163, TRUE), (DEFAULT, 164, TRUE), (DEFAULT, 165, TRUE), (DEFAULT, 166, TRUE), (DEFAULT, 167, TRUE), (DEFAULT, 168, TRUE), (DEFAULT, 169, TRUE), (DEFAULT, 170, TRUE), (DEFAULT, 171, TRUE), (DEFAULT, 172, TRUE), (DEFAULT, 173, TRUE), (DEFAULT, 174, TRUE), (DEFAULT, 175, TRUE), (DEFAULT, 176, TRUE), (DEFAULT, 177, TRUE), (DEFAULT, 178, TRUE), (DEFAULT, 179, TRUE), (DEFAULT, 180, TRUE), (DEFAULT, 181, TRUE), (DEFAULT, 182, TRUE), (DEFAULT, 183, TRUE), (DEFAULT, 184, TRUE), (DEFAULT, 185, TRUE), (DEFAULT, 186, TRUE), (DEFAULT, 187, TRUE), (DEFAULT, 188, TRUE), (DEFAULT, 189, TRUE), (DEFAULT, 190, TRUE), (DEFAULT, 191, TRUE), (DEFAULT, 192, TRUE), (DEFAULT, 193, TRUE), (DEFAULT, 194, TRUE), (DEFAULT, 195, TRUE), (DEFAULT, 196, TRUE), (DEFAULT, 197, TRUE), (DEFAULT, 198, TRUE), (DEFAULT, 199, TRUE), (DEFAULT, 200, TRUE), (DEFAULT, 201, TRUE), (DEFAULT, 202, FALSE), (DEFAULT, 203, FALSE), (DEFAULT, 204, TRUE), (DEFAULT, 205, TRUE), (DEFAULT, 206, FALSE), (DEFAULT, 207, FALSE), (DEFAULT, 208, TRUE), (DEFAULT, 209, TRUE), (DEFAULT, 210, FALSE), (DEFAULT, 211, FALSE), (DEFAULT, 212, TRUE), (DEFAULT, 213, TRUE), (DEFAULT, 214, TRUE), (DEFAULT, 215, TRUE), (DEFAULT, 216, TRUE), (DEFAULT, 217, TRUE), (DEFAULT, 218, TRUE), (DEFAULT, 219, TRUE), (DEFAULT, 220, TRUE), (DEFAULT, 221, TRUE), (DEFAULT, 222, TRUE), (DEFAULT, 223, TRUE), (DEFAULT, 224, TRUE), (DEFAULT, 225, TRUE), (DEFAULT, 226, TRUE), (DEFAULT, 227, TRUE), (DEFAULT, 228, TRUE), (DEFAULT, 229, TRUE), (DEFAULT, 230, TRUE), (DEFAULT, 231, TRUE), (DEFAULT, 232, TRUE), (DEFAULT, 233, TRUE), (DEFAULT, 234, TRUE), (DEFAULT, 235, TRUE), (DEFAULT, 236, TRUE), (DEFAULT, 237, TRUE), (DEFAULT, 238, TRUE), (DEFAULT, 239, TRUE), (DEFAULT, 240, TRUE), (DEFAULT, 241, TRUE), (DEFAULT, 242, TRUE), (DEFAULT, 243, TRUE), (DEFAULT, 244, TRUE), (DEFAULT, 245, TRUE), (DEFAULT, 246, TRUE), (DEFAULT, 247, TRUE), (DEFAULT, 248, TRUE), (DEFAULT, 249, TRUE), (DEFAULT, 250, TRUE), (DEFAULT, 251, TRUE), (DEFAULT, 252, TRUE), (DEFAULT, 253, TRUE), (DEFAULT, 254, TRUE), (DEFAULT, 255, TRUE), (DEFAULT, 256, TRUE), (DEFAULT, 257, TRUE), (DEFAULT, 258, TRUE), (DEFAULT, 259, TRUE), (DEFAULT, 260, TRUE), (DEFAULT, 261, TRUE), (DEFAULT, 262, TRUE), (DEFAULT, 263, TRUE), (DEFAULT, 264, TRUE), (DEFAULT, 265, TRUE), (DEFAULT, 266, TRUE), (DEFAULT, 267, TRUE), (DEFAULT, 268, TRUE), (DEFAULT, 269, TRUE), (DEFAULT, 270, TRUE), (DEFAULT, 271, TRUE), (DEFAULT, 272, TRUE), (DEFAULT, 273, TRUE), (DEFAULT, 274, TRUE), (DEFAULT, 275, TRUE), (DEFAULT, 276, TRUE), (DEFAULT, 277, TRUE), (DEFAULT, 278, TRUE), (DEFAULT, 279, TRUE), (DEFAULT, 280, TRUE), (DEFAULT, 281, TRUE), (DEFAULT, 282, TRUE), (DEFAULT, 283, TRUE), (DEFAULT, 284, TRUE), (DEFAULT, 285, TRUE), (DEFAULT, 286, TRUE), (DEFAULT, 287, TRUE), (DEFAULT, 288, TRUE), (DEFAULT, 289, TRUE), (DEFAULT, 290, TRUE), (DEFAULT, 291, TRUE), (DEFAULT, 292, TRUE), (DEFAULT, 293, TRUE), (DEFAULT, 294, TRUE), (DEFAULT, 295, TRUE), (DEFAULT, 296, TRUE), (DEFAULT, 297, TRUE), (DEFAULT, 298, TRUE), (DEFAULT, 299, TRUE), (DEFAULT, 300, TRUE), (DEFAULT, 301, TRUE), (DEFAULT, 302, TRUE), (DEFAULT, 303, TRUE), (DEFAULT, 304, TRUE), (DEFAULT, 305, TRUE), (DEFAULT, 306, TRUE), (DEFAULT, 307, TRUE), (DEFAULT, 308, TRUE), (DEFAULT, 309, TRUE), (DEFAULT, 310, TRUE), (DEFAULT, 311, TRUE), (DEFAULT, 312, TRUE), (DEFAULT, 313, TRUE), (DEFAULT, 314, TRUE), (DEFAULT, 315, TRUE), (DEFAULT, 316, TRUE), (DEFAULT, 317, TRUE), (DEFAULT, 318, TRUE), (DEFAULT, 319, TRUE), (DEFAULT, 320, TRUE), (DEFAULT, 321, TRUE), (DEFAULT, 322, TRUE), (DEFAULT, 323, TRUE), (DEFAULT, 324, TRUE), (DEFAULT, 325, TRUE), (DEFAULT, 326, TRUE), (DEFAULT, 327, TRUE), (DEFAULT, 328, TRUE), (DEFAULT, 329, TRUE), (DEFAULT, 330, TRUE), (DEFAULT, 331, TRUE), (DEFAULT, 332, TRUE), (DEFAULT, 333, TRUE), (DEFAULT, 334, TRUE), (DEFAULT, 335, TRUE), (DEFAULT, 336, TRUE), (DEFAULT, 337, TRUE), (DEFAULT, 338, TRUE), (DEFAULT, 339, TRUE), (DEFAULT, 340, TRUE), (DEFAULT, 341, TRUE), (DEFAULT, 342, TRUE), (DEFAULT, 343, TRUE), (DEFAULT, 344, TRUE), (DEFAULT, 345, TRUE), (DEFAULT, 346, TRUE), (DEFAULT, 347, TRUE), (DEFAULT, 348, TRUE), (DEFAULT, 349, TRUE), (DEFAULT, 350, TRUE), (DEFAULT, 351, TRUE), (DEFAULT, 352, TRUE), (DEFAULT, 353, TRUE), (DEFAULT, 354, TRUE), (DEFAULT, 355, TRUE), (DEFAULT, 356, TRUE), (DEFAULT, 357, TRUE), (DEFAULT, 358, TRUE), (DEFAULT, 359, TRUE), (DEFAULT, 360, TRUE), (DEFAULT, 361, TRUE), (DEFAULT, 362, TRUE), (DEFAULT, 363, TRUE), (DEFAULT, 364, TRUE), (DEFAULT, 365, TRUE), (DEFAULT, 366, TRUE), (DEFAULT, 367, TRUE), (DEFAULT, 368, TRUE), (DEFAULT, 369, TRUE), (DEFAULT, 370, TRUE), (DEFAULT, 371, TRUE), (DEFAULT, 372, TRUE), (DEFAULT, 373, TRUE), (DEFAULT, 374, TRUE), (DEFAULT, 375, TRUE), (DEFAULT, 376, TRUE), (DEFAULT, 377, TRUE), (DEFAULT, 378, TRUE), (DEFAULT, 379, TRUE), (DEFAULT, 380, TRUE), (DEFAULT, 381, TRUE), (DEFAULT, 382, TRUE), (DEFAULT, 383, TRUE), (DEFAULT, 384, TRUE), (DEFAULT, 385, TRUE), (DEFAULT, 386, TRUE), (DEFAULT, 387, TRUE), (DEFAULT, 388, TRUE), (DEFAULT, 389, TRUE), (DEFAULT, 390, TRUE), (DEFAULT, 391, TRUE), (DEFAULT, 392, TRUE), (DEFAULT, 393, TRUE), (DEFAULT, 394, TRUE), (DEFAULT, 395, TRUE), (DEFAULT, 396, TRUE), (DEFAULT, 397, TRUE), (DEFAULT, 398, TRUE), (DEFAULT, 399, TRUE), (DEFAULT, 400, TRUE), (DEFAULT, 401, TRUE), (DEFAULT, 402, TRUE), (DEFAULT, 403, TRUE), (DEFAULT, 404, TRUE), (DEFAULT, 405, TRUE), (DEFAULT, 406, TRUE), (DEFAULT, 407, TRUE), (DEFAULT, 408, TRUE), (DEFAULT, 409, TRUE), (DEFAULT, 410, TRUE), (DEFAULT, 411, TRUE), (DEFAULT, 412, TRUE), (DEFAULT, 413, TRUE), (DEFAULT, 414, TRUE), (DEFAULT, 415, TRUE), (DEFAULT, 416, TRUE), (DEFAULT, 417, TRUE), (DEFAULT, 418, TRUE), (DEFAULT, 419, TRUE), (DEFAULT, 420, TRUE), (DEFAULT, 421, TRUE), (DEFAULT, 422, TRUE), (DEFAULT, 423, TRUE), (DEFAULT, 424, TRUE), (DEFAULT, 425, TRUE), (DEFAULT, 426, TRUE), (DEFAULT, 427, TRUE), (DEFAULT, 428, TRUE), (DEFAULT, 429, TRUE), (DEFAULT, 430, TRUE), (DEFAULT, 431, TRUE), (DEFAULT, 432, TRUE), (DEFAULT, 433, TRUE), (DEFAULT, 434, TRUE), (DEFAULT, 435, TRUE), (DEFAULT, 436, TRUE), (DEFAULT, 437, TRUE), (DEFAULT, 438, TRUE), (DEFAULT, 439, TRUE), (DEFAULT, 440, TRUE), (DEFAULT, 441, TRUE), (DEFAULT, 442, TRUE), (DEFAULT, 443, TRUE), (DEFAULT, 444, TRUE), (DEFAULT, 445, TRUE), (DEFAULT, 446, TRUE), (DEFAULT, 447, TRUE), (DEFAULT, 448, TRUE), (DEFAULT, 449, TRUE), (DEFAULT, 450, TRUE), (DEFAULT, 451, TRUE), (DEFAULT, 452, TRUE), (DEFAULT, 453, TRUE), (DEFAULT, 454, TRUE), (DEFAULT, 455, TRUE), (DEFAULT, 456, TRUE), (DEFAULT, 457, TRUE), (DEFAULT, 458, TRUE), (DEFAULT, 459, TRUE), (DEFAULT, 460, TRUE), (DEFAULT, 461, TRUE), (DEFAULT, 462, TRUE), (DEFAULT, 463, TRUE), (DEFAULT, 464, TRUE), (DEFAULT, 465, TRUE), (DEFAULT, 466, TRUE), (DEFAULT, 467, TRUE), (DEFAULT, 468, TRUE), (DEFAULT, 469, TRUE), (DEFAULT, 470, TRUE), (DEFAULT, 471, TRUE), (DEFAULT, 472, TRUE), (DEFAULT, 473, TRUE), (DEFAULT, 474, TRUE), (DEFAULT, 475, TRUE); +INSERT INTO virtual_instrument.resource_group_to_resource_group VALUES (DEFAULT, 156, 135), (DEFAULT, 157, 135), (DEFAULT, 158, 135), (DEFAULT, 159, 135), (DEFAULT, 160, 135), (DEFAULT, 161, 135), (DEFAULT, 162, 135), (DEFAULT, 163, 135), (DEFAULT, 164, 135), (DEFAULT, 165, 135), (DEFAULT, 166, 135), (DEFAULT, 167, 135), (DEFAULT, 168, 135), (DEFAULT, 169, 135), (DEFAULT, 170, 135), (DEFAULT, 171, 135), (DEFAULT, 172, 135), (DEFAULT, 173, 136), (DEFAULT, 174, 136), (DEFAULT, 175, 136), (DEFAULT, 176, 136), (DEFAULT, 177, 136), (DEFAULT, 178, 136), (DEFAULT, 179, 136), (DEFAULT, 180, 136), (DEFAULT, 181, 136), (DEFAULT, 182, 136), (DEFAULT, 183, 136), (DEFAULT, 184, 136), (DEFAULT, 185, 136), (DEFAULT, 186, 136), (DEFAULT, 187, 136), (DEFAULT, 188, 137), (DEFAULT, 189, 137), (DEFAULT, 190, 137), (DEFAULT, 191, 137), (DEFAULT, 192, 137), (DEFAULT, 193, 137), (DEFAULT, 194, 137), (DEFAULT, 195, 137), (DEFAULT, 196, 137), (DEFAULT, 197, 137), (DEFAULT, 198, 137), (DEFAULT, 199, 137), (DEFAULT, 200, 137), (DEFAULT, 201, 137), (DEFAULT, 202, 137), (DEFAULT, 206, 149), (DEFAULT, 207, 149), (DEFAULT, 208, 150), (DEFAULT, 209, 150), (DEFAULT, 210, 151), (DEFAULT, 211, 151), (DEFAULT, 212, 152), (DEFAULT, 213, 152), (DEFAULT, 214, 153), (DEFAULT, 215, 153), (DEFAULT, 216, 154), (DEFAULT, 217, 154), (DEFAULT, 218, 155), (DEFAULT, 219, 155), (DEFAULT, 220, 156), (DEFAULT, 221, 156), (DEFAULT, 222, 157), (DEFAULT, 223, 157), (DEFAULT, 224, 158), (DEFAULT, 225, 158), (DEFAULT, 226, 159), (DEFAULT, 227, 159), (DEFAULT, 228, 160), (DEFAULT, 229, 160), (DEFAULT, 230, 161), (DEFAULT, 231, 161), (DEFAULT, 232, 162), (DEFAULT, 233, 162), (DEFAULT, 234, 163), (DEFAULT, 235, 163), (DEFAULT, 236, 164), (DEFAULT, 237, 164), (DEFAULT, 238, 165), (DEFAULT, 239, 165), (DEFAULT, 240, 166), (DEFAULT, 241, 166), (DEFAULT, 242, 167), (DEFAULT, 243, 167), (DEFAULT, 244, 168), (DEFAULT, 245, 168), (DEFAULT, 246, 169), (DEFAULT, 247, 169), (DEFAULT, 248, 170), (DEFAULT, 249, 170), (DEFAULT, 250, 171), (DEFAULT, 251, 171), (DEFAULT, 252, 172), (DEFAULT, 253, 172), (DEFAULT, 254, 173), (DEFAULT, 255, 174), (DEFAULT, 256, 175), (DEFAULT, 257, 176), (DEFAULT, 258, 177), (DEFAULT, 259, 178), (DEFAULT, 260, 179), (DEFAULT, 261, 180), (DEFAULT, 262, 181), (DEFAULT, 263, 182), (DEFAULT, 264, 183), (DEFAULT, 265, 184), (DEFAULT, 266, 185), (DEFAULT, 267, 186), (DEFAULT, 268, 187), (DEFAULT, 269, 188), (DEFAULT, 270, 189), (DEFAULT, 271, 190), (DEFAULT, 272, 191), (DEFAULT, 273, 192), (DEFAULT, 274, 193), (DEFAULT, 275, 194), (DEFAULT, 276, 195), (DEFAULT, 277, 196), (DEFAULT, 278, 197), (DEFAULT, 279, 198), (DEFAULT, 280, 199), (DEFAULT, 281, 200), (DEFAULT, 282, 201), (DEFAULT, 283, 202), (DEFAULT, 149, 138), (DEFAULT, 150, 138), (DEFAULT, 151, 138), (DEFAULT, 152, 138), (DEFAULT, 153, 138), (DEFAULT, 154, 138), (DEFAULT, 155, 141), (DEFAULT, 156, 141), (DEFAULT, 157, 141), (DEFAULT, 158, 141), (DEFAULT, 159, 141), (DEFAULT, 160, 141), (DEFAULT, 161, 141), (DEFAULT, 162, 141), (DEFAULT, 163, 141), (DEFAULT, 164, 141), (DEFAULT, 165, 141), (DEFAULT, 166, 141), (DEFAULT, 167, 141), (DEFAULT, 168, 141), (DEFAULT, 169, 141), (DEFAULT, 170, 141), (DEFAULT, 171, 141), (DEFAULT, 172, 141), (DEFAULT, 149, 143), (DEFAULT, 150, 143), (DEFAULT, 151, 143), (DEFAULT, 152, 143), (DEFAULT, 153, 143), (DEFAULT, 154, 143), (DEFAULT, 156, 143), (DEFAULT, 157, 143), (DEFAULT, 158, 143), (DEFAULT, 159, 143), (DEFAULT, 165, 143), (DEFAULT, 149, 144), (DEFAULT, 150, 144), (DEFAULT, 151, 144), (DEFAULT, 152, 144), (DEFAULT, 153, 144), (DEFAULT, 154, 144), (DEFAULT, 155, 144), (DEFAULT, 156, 144), (DEFAULT, 157, 144), (DEFAULT, 158, 144), (DEFAULT, 159, 144), (DEFAULT, 160, 144), (DEFAULT, 161, 144), (DEFAULT, 162, 144), (DEFAULT, 163, 144), (DEFAULT, 164, 144), (DEFAULT, 165, 144), (DEFAULT, 166, 144), (DEFAULT, 168, 144), (DEFAULT, 169, 144), (DEFAULT, 171, 144), (DEFAULT, 172, 144), (DEFAULT, 172, 139), (DEFAULT, 149, 140), (DEFAULT, 149, 139), (DEFAULT, 150, 140), (DEFAULT, 150, 139), (DEFAULT, 151, 140), (DEFAULT, 151, 139), (DEFAULT, 152, 140), (DEFAULT, 152, 139), (DEFAULT, 153, 140), (DEFAULT, 153, 139), (DEFAULT, 154, 140), (DEFAULT, 154, 139), (DEFAULT, 155, 140), (DEFAULT, 155, 139), (DEFAULT, 156, 140), (DEFAULT, 156, 139), (DEFAULT, 157, 140), (DEFAULT, 157, 139), (DEFAULT, 158, 140), (DEFAULT, 158, 139), (DEFAULT, 159, 140), (DEFAULT, 159, 139), (DEFAULT, 160, 140), (DEFAULT, 160, 139), (DEFAULT, 161, 140), (DEFAULT, 161, 139), (DEFAULT, 162, 140), (DEFAULT, 162, 139), (DEFAULT, 163, 140), (DEFAULT, 163, 139), (DEFAULT, 164, 140), (DEFAULT, 164, 139), (DEFAULT, 165, 140), (DEFAULT, 165, 139), (DEFAULT, 166, 140), (DEFAULT, 166, 139), (DEFAULT, 167, 140), (DEFAULT, 167, 139), (DEFAULT, 168, 140), (DEFAULT, 168, 139), (DEFAULT, 169, 140), (DEFAULT, 169, 139), (DEFAULT, 170, 140), (DEFAULT, 170, 139), (DEFAULT, 171, 140), (DEFAULT, 171, 139), (DEFAULT, 172, 140), (DEFAULT, 172, 139), (DEFAULT, 173, 140), (DEFAULT, 173, 139), (DEFAULT, 174, 140), (DEFAULT, 174, 139), (DEFAULT, 175, 140), (DEFAULT, 175, 139), (DEFAULT, 176, 140), (DEFAULT, 176, 139), (DEFAULT, 177, 140), (DEFAULT, 177, 139), (DEFAULT, 178, 140), (DEFAULT, 178, 139), (DEFAULT, 179, 140), (DEFAULT, 179, 139), (DEFAULT, 180, 140), (DEFAULT, 180, 139), (DEFAULT, 181, 140), (DEFAULT, 181, 139), (DEFAULT, 182, 140), (DEFAULT, 182, 139), (DEFAULT, 183, 140), (DEFAULT, 183, 139), (DEFAULT, 184, 140), (DEFAULT, 184, 139), (DEFAULT, 185, 140), (DEFAULT, 185, 139), (DEFAULT, 186, 140), (DEFAULT, 186, 139), (DEFAULT, 187, 140), (DEFAULT, 187, 139), (DEFAULT, 188, 137), (DEFAULT, 188, 139), (DEFAULT, 189, 137), (DEFAULT, 189, 139), (DEFAULT, 190, 137), (DEFAULT, 190, 139), (DEFAULT, 191, 137), (DEFAULT, 191, 139), (DEFAULT, 192, 137), (DEFAULT, 192, 139), (DEFAULT, 193, 137), (DEFAULT, 193, 139), (DEFAULT, 194, 137), (DEFAULT, 194, 139), (DEFAULT, 195, 137), (DEFAULT, 195, 139), (DEFAULT, 196, 137), (DEFAULT, 196, 139), (DEFAULT, 197, 137), (DEFAULT, 197, 139), (DEFAULT, 198, 137), (DEFAULT, 198, 139), (DEFAULT, 199, 137), (DEFAULT, 199, 139), (DEFAULT, 200, 137), (DEFAULT, 200, 139), (DEFAULT, 201, 137), (DEFAULT, 201, 139), (DEFAULT, 202, 137), (DEFAULT, 0, NULL), (DEFAULT, 1, 0), (DEFAULT, 2, 0), (DEFAULT, 63, 0), (DEFAULT, 3, 1), (DEFAULT, 4, 1), (DEFAULT, 64, 63), (DEFAULT, 65, 63), (DEFAULT, 135, 0), (DEFAULT, 136, 0), (DEFAULT, 137, 0), (DEFAULT, 138, 0), (DEFAULT, 139, 0), (DEFAULT, 140, 0), (DEFAULT, 141, 0), (DEFAULT, 142, 0), (DEFAULT, 143, 0), (DEFAULT, 144, 0), (DEFAULT, 145, 0), (DEFAULT, 5, 3), (DEFAULT, 6, 3), (DEFAULT, 7, 3), (DEFAULT, 8, 3), (DEFAULT, 9, 3), (DEFAULT, 10, 3), (DEFAULT, 11, 3), (DEFAULT, 12, 3), (DEFAULT, 13, 3), (DEFAULT, 14, 3), (DEFAULT, 15, 3), (DEFAULT, 16, 3), (DEFAULT, 17, 3), (DEFAULT, 18, 3), (DEFAULT, 19, 3), (DEFAULT, 20, 3), (DEFAULT, 21, 3), (DEFAULT, 22, 3), (DEFAULT, 23, 3), (DEFAULT, 24, 3), (DEFAULT, 25, 3), (DEFAULT, 26, 3), (DEFAULT, 27, 3), (DEFAULT, 28, 3), (DEFAULT, 29, 3), (DEFAULT, 30, 3), (DEFAULT, 31, 3), (DEFAULT, 32, 3), (DEFAULT, 33, 3), (DEFAULT, 34, 3), (DEFAULT, 35, 3), (DEFAULT, 36, 3), (DEFAULT, 37, 3), (DEFAULT, 38, 3), (DEFAULT, 39, 3), (DEFAULT, 40, 3), (DEFAULT, 41, 3), (DEFAULT, 42, 3), (DEFAULT, 43, 3), (DEFAULT, 44, 3), (DEFAULT, 45, 3), (DEFAULT, 46, 3), (DEFAULT, 47, 3), (DEFAULT, 48, 3), (DEFAULT, 49, 3), (DEFAULT, 50, 3), (DEFAULT, 51, 3), (DEFAULT, 52, 3), (DEFAULT, 53, 3), (DEFAULT, 54, 3), (DEFAULT, 55, 2), (DEFAULT, 56, 2), (DEFAULT, 57, 2), (DEFAULT, 58, 2), (DEFAULT, 59, 2), (DEFAULT, 60, 2), (DEFAULT, 61, 2), (DEFAULT, 62, 2), (DEFAULT, 66, 64), (DEFAULT, 67, 66), (DEFAULT, 68, 66), (DEFAULT, 69, 64), (DEFAULT, 70, 69), (DEFAULT, 71, 69), (DEFAULT, 72, 64), (DEFAULT, 73, 72), (DEFAULT, 74, 72), (DEFAULT, 75, 64), (DEFAULT, 76, 75), (DEFAULT, 77, 75), (DEFAULT, 78, 64), (DEFAULT, 79, 78), (DEFAULT, 80, 78), (DEFAULT, 81, 64), (DEFAULT, 82, 81), (DEFAULT, 83, 81), (DEFAULT, 84, 64), (DEFAULT, 85, 84), (DEFAULT, 86, 84), (DEFAULT, 87, 64), (DEFAULT, 88, 87), (DEFAULT, 89, 87), (DEFAULT, 90, 64), (DEFAULT, 91, 90), (DEFAULT, 92, 90), (DEFAULT, 93, 64), (DEFAULT, 94, 93), (DEFAULT, 95, 93), (DEFAULT, 96, 64), (DEFAULT, 97, 96), (DEFAULT, 98, 96), (DEFAULT, 99, 64), (DEFAULT, 100, 99), (DEFAULT, 101, 99), (DEFAULT, 102, 64), (DEFAULT, 103, 102), (DEFAULT, 104, 102), (DEFAULT, 105, 64), (DEFAULT, 106, 105), (DEFAULT, 107, 105), (DEFAULT, 108, 64), (DEFAULT, 109, 108), (DEFAULT, 110, 108), (DEFAULT, 111, 64), (DEFAULT, 112, 111), (DEFAULT, 113, 111), (DEFAULT, 114, 64), (DEFAULT, 115, 114), (DEFAULT, 116, 114), (DEFAULT, 117, 64), (DEFAULT, 118, 117), (DEFAULT, 119, 117), (DEFAULT, 120, 64), (DEFAULT, 121, 120), (DEFAULT, 122, 120), (DEFAULT, 123, 64), (DEFAULT, 124, 123), (DEFAULT, 125, 123), (DEFAULT, 126, 64), (DEFAULT, 127, 126), (DEFAULT, 128, 126), (DEFAULT, 129, 64), (DEFAULT, 130, 129), (DEFAULT, 131, 129), (DEFAULT, 132, 64), (DEFAULT, 133, 132), (DEFAULT, 134, 132), (DEFAULT, 149, 135), (DEFAULT, 150, 135), (DEFAULT, 151, 135), (DEFAULT, 152, 135), (DEFAULT, 153, 135), (DEFAULT, 154, 135), (DEFAULT, 155, 135); +COMMIT; diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_add_notifications.sql.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_add_notifications.sql.py new file mode 100755 index 0000000000000000000000000000000000000000..fe8e3680a613831a2ea9fc8b0f21d94d04a790ad --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_add_notifications.sql.py @@ -0,0 +1,62 @@ +#!/usr/bin/python + +# Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy) +# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands +# +# This file is part of the LOFAR software suite. +# The LOFAR software suite is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# The LOFAR software suite is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. + +# $Id: radb.py 33394 2016-01-25 15:53:55Z schaap $ + +''' +TODO: documentation +''' +import logging + +from lofar.common.postgres import makePostgresNotificationQueries + +logger = logging.getLogger(__name__) + +if __name__ == '__main__': + with open('add_notifications.sql', 'wt') as f: + f.write('--this file was generated by create_add_notifications.sql.py\n') + f.write('--it creates triggers and functions which fire postgres notify events upon the given table actions\n') + f.write('--these notify events can be listened to implenting a subclass of the PostgresListener in the lofar.common.postgres python module\n') + f.write('--for the radb such a subclass has been made, which listens specifically to the notifications defined below\n') + f.write('--RADBPGListener in module lofar.sas.resourceassignment.database.radbpglistener\n') + f.write('--this RADBPGListener then broadcasts the event on the lofar bus.\n') + f.write('\n') + + f.write('\nBEGIN;\n\n') + + f.write('-- only issue >warnings log messages. (only during this transaction)\n') + f.write('SET LOCAL client_min_messages=warning;\n\n') + + f.writelines(makePostgresNotificationQueries('resource_allocation', 'task', 'INSERT')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'task', 'UPDATE')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'task', 'DELETE')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'task_predecessor', 'INSERT', column_name='task_id')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'task_predecessor', 'UPDATE', column_name='task_id')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'task_predecessor', 'DELETE', column_name='task_id')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'task_predecessor', 'INSERT', column_name='predecessor_id')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'task_predecessor', 'UPDATE', column_name='predecessor_id')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'task_predecessor', 'DELETE', column_name='predecessor_id')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'specification', 'UPDATE')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'resource_claim', 'INSERT')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'resource_claim', 'UPDATE')) + f.writelines(makePostgresNotificationQueries('resource_allocation', 'resource_claim', 'DELETE')) + f.writelines(makePostgresNotificationQueries('resource_monitoring', 'resource_availability', 'UPDATE', column_name='resource_id')) + f.writelines(makePostgresNotificationQueries('resource_monitoring', 'resource_capacity', 'UPDATE', column_name='resource_id')) + + f.write('\nCOMMIT;\n') diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_add_virtual_instrument.sql.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_add_virtual_instrument.sql.py new file mode 100755 index 0000000000000000000000000000000000000000..016bc6547710c09a8b9e90597d59ebdd8f2c67d1 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_add_virtual_instrument.sql.py @@ -0,0 +1,544 @@ +#!/usr/bin/python +# create_add_virtual_instrument.sql.py: generate add_virtual_instrument.sql +# +# Copyright (C) 2016, 2017 +# ASTRON (Netherlands Institute for Radio Astronomy) +# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +# +# This file is part of the LOFAR software suite. +# The LOFAR software suite is free software: you can redistribute it +# and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# The LOFAR software suite is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. +# +# $Id$ + +with open("add_virtual_instrument.sql", 'w+') as output: + + output.write("-- This file was generated by the \'create_add_virtual_instrument.sql.py\' script.\n") + output.write("-- Please do not modify this sql file, but modify and the python script if you want a different virtual instrument.\n\n") + output.write("-- resourceassignment password for testing on mcu005 is the same as the password on the president's luggage +6\n") + output.write("-- psql resourceassignment -U resourceassignment -f add_virtual_instrument.sql -W\n") + output.write("BEGIN;\n") + + output.write("-- start with clearing the old virtual instrument model\n") + output.write("-- for some reason truncate takes a looooong time to complete, so use delete from\n") + output.write("DELETE FROM virtual_instrument.resource_group_to_resource_group CASCADE;\n") + output.write("DELETE FROM virtual_instrument.resource_to_resource_group CASCADE;\n") + output.write("DELETE FROM virtual_instrument.resource_group CASCADE;\n") + output.write("DELETE FROM virtual_instrument.resource_group_type CASCADE;\n") + output.write("DELETE FROM virtual_instrument.resource CASCADE;\n") + output.write("DELETE FROM virtual_instrument.resource_type CASCADE;\n") + output.write("DELETE FROM virtual_instrument.unit CASCADE;\n") + output.write("-- end of initial cleanup\n\n") + + + # NOTE: each id is fixed once used in operations. When adding ids, only assign unused numbers! + # Removing is only possible once no longer present in operational DBs. (Better comment it out and mark as deprecated.) + # Repurposing an id would require renumbering ids in DBs in operations on every software roll-out and roll-back... + + def assert_unique_ids(d, msg): + """ checks if all d.values() are unique """ + if len(d.values()) != len(set(d.values())): + raise Exception(msg) + + def assert_unique_ids0(d, msg): + """ checks if all d.values()[0] are unique """ + if len(d.values()) != len({v[0] for v in d.values()}): + raise Exception(msg) + + class SqlKeyword: + """ SQL keywords like DEFAULT, NULL, TRUE, FALSE, ... need to be written without + Python str quotes when printed, also inside a list, tuple, set, dict, ... + Wrapping such keywords in this simple object does the trick. + E.g. in ipython: + str(['DEFAULT']) -> "['DEFAULT']" + str([SqlKeyword('DEFAULT')]) -> '[DEFAULT]' + """ + def __init__(self, s): + self.s = s + def __repr__(self): + return self.s + + def format_inverse_dict(d): + """ {'foo': 1, 'bar': 2, ...} -> "(1, 'foo'), (2, 'bar'), ..." """ + return str(sorted(zip(d.values(), d.keys())))[1:-1] + + def format_inverse_list(l): + """ [('foo', 1), ('bar', 20, ...] -> "(1, 'foo'), (2, 'bar'), ..." """ + l = [(t[1], t[0]) + t[2:] for t in l] #FIXME, might only work for list of size 3 tuples? + return str(sorted(l))[1:-1] + + def format_inverse_dict2(d, out_sort_idx): + """ {'foo': (1, 10), 'bar': (2, 20), ...} -> "(1, 'foo', 10), (2, 'bar', 20), ..." """ + return str(sorted([(x[1][0], x[0], x[1][1]) for x in d.items()], key=lambda v: v[out_sort_idx]))[1:-1] + + def format_inverse_dict3(d, out_sort_idx): + """ {'foo': (1, 10, 100), 'bar': (2, 20, 200), ...} -> "(1, 'foo', 10, 100), (2, 'bar', 20, 200), ..." """ + return str(sorted([(x[1][0], x[0], x[1][1], x[1][2]) for x in d.items()], key=lambda v: v[out_sort_idx]))[1:-1] + + + #----- resource unit ------------------------------------------------------------------- + resource_units = { + # name : id + 'rsp_channel_bit' : 0, + 'bytes' : 1, + 'rcu_board' : 2, + 'bits/second' : 3, + 'cores' : 4, + } + assert_unique_ids(resource_units, 'Error: Not all ids in resource_units are unique!') + output.write("INSERT INTO virtual_instrument.unit VALUES %s;\n" % + format_inverse_dict(resource_units)) + + + #----- resource type ------------------------------------------------------------------- + resource_types = { + # name : (id, unit id) + 'rsp' : ( 0, resource_units['rsp_channel_bit']), + 'tbb' : ( 1, resource_units['bytes']), + 'rcu' : ( 2, resource_units['rcu_board']), + 'bandwidth' : ( 3, resource_units['bits/second']), + 'processor' : ( 4, resource_units['cores']), + 'storage' : ( 5, resource_units['bytes']), + } + assert_unique_ids0(resource_types, 'Error: Not all ids in resource_types are unique!') + output.write("INSERT INTO virtual_instrument.resource_type VALUES %s;\n" % + format_inverse_dict2(resource_types, 0)) + + + #----- resource_group type ------------------------------------------------------------- + resource_group_types = { + # name : id + 'instrument' : 0, + 'cluster' : 1, + 'station_group' : 2, + 'station' : 3, + # NOTE: Some resource groups physically contain >1 resource of the same (e.g. storage) + # type plus for each such resource another resource of type bandwidth to access it. + # In that case, we place each resource + its bandwidth under their own 'virtual' + # node group. The virtual node groups fall under the original resource group. + # This allows the Resource Assigner to produce a claim for a data product on one of + # the resources and *its* bandwidth (instead of another resource's bandwidth). + # A 'standalone' bandwidth resource is still possible (e.g. inter-cluster bandwidth). + # The 'virtual' name was generalized from 'node_group' carrying a node (sub-)set. + 'virtual' : 4, + 'node' : 5, + 'rsp' : 6, + } + assert_unique_ids(resource_group_types, 'Error: Not all ids in resource_group_types are unique!') + output.write("INSERT INTO virtual_instrument.resource_group_type VALUES %s;\n" % + format_inverse_dict(resource_group_types)) + + + #----- resource groups ----------------------------------------------------------------- + resource_groups = { + # name : ( id, resource_group_type id) + 'LOFAR' : ( 0, resource_group_types['instrument']), + + 'CEP4' : ( 1, resource_group_types['cluster']), + 'COBALT' : ( 2, resource_group_types['cluster']), + 'DRAGNET' : ( 63, resource_group_types['cluster']), + + 'computenodes' : ( 3, resource_group_types['virtual']), # CEP4 + 'gpunodes' : ( 4, resource_group_types['virtual']), # CEP4 + 'drgnodes' : ( 64, resource_group_types['virtual']), # DRAGNET + + 'dragproc' : ( 65, resource_group_types['node']), # DRAGNET + + # Decided not to use ALL, as these have actually different resources. + 'CORE' : ( 135, resource_group_types['station_group']), + 'REMOTE' : ( 136, resource_group_types['station_group']), + 'INTERNATIONAL' : ( 137, resource_group_types['station_group']), + + # Not sure if we should use virtual here. + 'SUPERTERP' : ( 138, resource_group_types['virtual']), + 'ALL' : ( 139, resource_group_types['virtual']), + 'NL' : ( 140, resource_group_types['virtual']), + 'CoreSansST' : ( 141, resource_group_types['virtual']), ## Outer Core? + 'VLBI' : ( 142, resource_group_types['virtual']), + 'AARTFAAC' : ( 143, resource_group_types['virtual']), + 'CORE2KM' : ( 144, resource_group_types['virtual']), + 'LORA' : ( 145, resource_group_types['virtual']), +# 'RESERVED' : ( 146, resource_group_types['virtual']), +# 'RESERVED' : ( 147, resource_group_types['virtual']), +# 'RESERVED' : ( 148, resource_group_types['virtual']), + +# 'IS615' : ( 203, resource_group_types['station']), +# 'IS616' : ( 204, resource_group_types['station']), +# 'IS617' : ( 205, resource_group_types['station']), + } + + ## CEP4 cpu nodes (cpu01 - cpu50) + num_cpu_nodes = 50 # if we get more cpu nodes, do not incr this, but instead add new sequence(s) to avoid repurposing ids + cpu01_id = 5 # ids 5-54 assigned + for i in xrange(num_cpu_nodes): + resource_groups['cpunode%02d' % (i + 1)] = (cpu01_id + i, resource_group_types['node']) + + ## COBALT nodes (cbt001 - cbt008) + #FIXME Should we model all 10 cobalt nodes? + num_cbt_nodes = 8 # if we get more cbt nodes, do not incr this, but instead add new sequence(s) to avoid repurposing ids + cbt001_id = 55 # ids 55-62 assigned + for i in xrange(num_cbt_nodes): + resource_groups['cbt%03d' % (i + 1)] = (cbt001_id + i, resource_group_types['node']) + + ## DRAGNET nodes (drg01 - drg23) + num_drg_nodes = 23 + drg01_id = 66 # ids 66-134 assigned (NOTE: 63,64,65 assigned to 'DRAGNET', 'drgnodes', 'dragproc') + for i in xrange(num_drg_nodes): + resource_groups['drg%02d' % (i + 1)] = (drg01_id + 3 * i + 0, resource_group_types['node']) + resource_groups['drg%02d-data1' % (i + 1)] = (drg01_id + 3 * i + 1, resource_group_types['virtual']) + resource_groups['drg%02d-data2' % (i + 1)] = (drg01_id + 3 * i + 2, resource_group_types['virtual']) + + ##stations + # Maybe this list should be imported from a central location? + # Something like CS001HBA0 should probably be translated at the estimator level into station and RSP + stations = ['CS001', 'CS002', 'CS003', 'CS004', 'CS005', 'CS006', 'CS007', 'CS011', 'CS013', 'CS017', + 'CS021', 'CS024', 'CS026', 'CS028', 'CS030', 'CS031', 'CS032', 'CS101', 'CS103', 'CS201', 'CS301', + 'CS302', 'CS401', 'CS501', 'RS106', 'RS205', 'RS208', 'RS210', 'RS305', 'RS306', 'RS307', 'RS310', 'RS406', + 'RS407', 'RS408', 'RS409', 'RS503', 'RS508', 'RS509', 'DE601', 'DE602', 'DE603', 'DE604', 'DE605', 'FR606', + 'SE607', 'UK608','DE609','PL610','PL611','PL612','IE613','IS614','TEST1'] + num_stations = 54 + num_nl_stations = 39 + assert len(stations) == num_stations + cs001_id = 149 # id's 149-202 assigned + + for i in xrange(num_stations): + resource_groups[stations[i]] = (cs001_id + i, resource_group_types['station']) + + num_splitter_stations = 24 # id's 210-257 assigned + cs001_rsp0_id = 206 # 203,204,205 ids reserved for stations + + for i in xrange(num_splitter_stations): + resource_groups[stations[i] + 'RSP0'] = (cs001_rsp0_id + 2 * i + 0, resource_group_types['rsp']) + resource_groups[stations[i] + 'RSP1'] = (cs001_rsp0_id + 2 * i + 1, resource_group_types['rsp']) + + rs106_rsp_id = 254 #id's 254-283 assigned + num_non_splitter_stations = num_stations - num_splitter_stations # calculated because of the reservations + for i in xrange(num_non_splitter_stations): + resource_groups[stations[i + num_splitter_stations] + 'RSP'] = (rs106_rsp_id + i, resource_group_types['rsp']) + + assert_unique_ids0(resource_groups, 'Error: Not all ids in resource_groups are unique!') + output.write("INSERT INTO virtual_instrument.resource_group VALUES %s;\n" % + format_inverse_dict2(resource_groups, 0)) + + + #----- resource ------------------------------------------------------------------------ + resources = { + # resource name : ( id, resource_type id) + 'CEP4_bandwidth:/data' : (116, resource_types['bandwidth'][0]), + 'CEP4_storage:/data' : (117, resource_types['storage'][0]), + 'dragproc_bandwidth:/data' : (118, resource_types['bandwidth'][0]), + 'dragproc_storage:/data' : (119, resource_types['storage'][0]), + } + + ## CEP4 cpunodes + cpu_node_resource_id0 = 0 # id's 0-99 assigned + for i in xrange(num_cpu_nodes): + resources['cpunode%02d_bandwidth' % (i + 1)] = (cpu_node_resource_id0 + 2 * i + 0, resource_types['bandwidth'][0]) + resources['cpunode%02d_processors' % (i + 1)] = (cpu_node_resource_id0 + 2 * i + 1, resource_types['processor'][0]) + + ## COBALT nodes + cbt_resource_id0 = 100 # id's 100-115 assigned + for i in xrange(num_cbt_nodes): + resources['cbt%03d_bandwidth' % (i + 1)] = (cbt_resource_id0 + 2 * i + 0, resource_types['bandwidth'][0]) + resources['cbt%03d_processors' % (i + 1)] = (cbt_resource_id0 + 2 * i + 1, resource_types['processor'][0]) + + ## DRAGNET nodes (except dragproc, listed above) + drg_resource_id0 = 120 # id's 120-211 assigned #FIXME AvA put 234 instead of 211 + for i in xrange(num_drg_nodes): + resources['drg%02d_bandwidth:/data1' % (i + 1)] = (drg_resource_id0 + 4 * i + 0, resource_types['bandwidth'][0]) + resources['drg%02d_bandwidth:/data2' % (i + 1)] = (drg_resource_id0 + 4 * i + 1, resource_types['bandwidth'][0]) + resources['drg%02d_storage:/data1' % (i + 1)] = (drg_resource_id0 + 4 * i + 2, resource_types['storage'][0]) + resources['drg%02d_storage:/data2' % (i + 1)] = (drg_resource_id0 + 4 * i + 3, resource_types['storage'][0]) + + ## Stations + station_resource_id = 212 # id's 212-319 assigned + for i in xrange(num_stations): + resources[stations[i] + 'rcu'] = (station_resource_id + 2 * i + 0, resource_types['rcu'][0]) + resources[stations[i] + 'tbb'] = (station_resource_id + 2 * i + 1, resource_types['tbb'][0]) + + ## RSPs + cs001_rsp0_resource_id = 320 # id's 320-415 assigned + for i in xrange(num_splitter_stations): + resources[stations[i] + 'chan0'] = (cs001_rsp0_resource_id + 4 * i + 0, resource_types['rsp'][0]) + resources[stations[i] + 'bw0'] = (cs001_rsp0_resource_id + 4 * i + 1, resource_types['bandwidth'][0]) + resources[stations[i] + 'chan1'] = (cs001_rsp0_resource_id + 4 * i + 2, resource_types['rsp'][0]) + resources[stations[i] + 'bw1'] = (cs001_rsp0_resource_id + 4 * i + 3, resource_types['bandwidth'][0]) + + rs106_rsp_resource_id = 416 #id's 416-476 assigned + for i in xrange(num_non_splitter_stations): + j = i + num_splitter_stations + resources[stations[j] + 'chan'] = (rs106_rsp_resource_id + 2 * i + 0, resource_types['rsp'][0]) + resources[stations[j] + 'bw'] = (rs106_rsp_resource_id + 2 * i + 1, resource_types['bandwidth'][0]) + + + assert_unique_ids0(resources, 'Error: Not all ids in resources are unique!') + output.write("INSERT INTO virtual_instrument.resource VALUES %s;\n" % + format_inverse_dict2(resources, 0)) + + + #----- resource_to_resource_group ------------------------------------------------------ + resource_to_resource_group_relations = { + # child resource id : (DEFAULT, parent resource_group id) + resources['CEP4_bandwidth:/data'][0] : (SqlKeyword('DEFAULT'), resource_groups['CEP4'][0]), + resources['CEP4_storage:/data'][0] : (SqlKeyword('DEFAULT'), resource_groups['CEP4'][0]), + resources['dragproc_bandwidth:/data'][0] : (SqlKeyword('DEFAULT'), resource_groups['dragproc'][0]), + resources['dragproc_storage:/data'][0] : (SqlKeyword('DEFAULT'), resource_groups['dragproc'][0]), + } + + ## CEP4 cpunodes + for i in xrange(num_cpu_nodes): + resource_to_resource_group_relations[ resources['cpunode%02d_bandwidth' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), resource_groups['cpunode%02d' % (i + 1)][0]) + resource_to_resource_group_relations[ resources['cpunode%02d_processors' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), resource_groups['cpunode%02d' % (i + 1)][0]) + + ## COBALT nodes + for i in xrange(num_cbt_nodes): + resource_to_resource_group_relations[ resources['cbt%03d_bandwidth' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), resource_groups['cbt%03d' % (i + 1)][0]) + resource_to_resource_group_relations[ resources['cbt%03d_processors' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), resource_groups['cbt%03d' % (i + 1)][0]) + + ## DRAGNET nodes (except dragproc, listed above) + for i in xrange(num_drg_nodes): + resource_to_resource_group_relations[ resources['drg%02d_bandwidth:/data1' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), resource_groups['drg%02d-data1' % (i + 1)][0]) + resource_to_resource_group_relations[ resources['drg%02d_bandwidth:/data2' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), resource_groups['drg%02d-data2' % (i + 1)][0]) + resource_to_resource_group_relations[ resources['drg%02d_storage:/data1' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), resource_groups['drg%02d-data1' % (i + 1)][0]) + resource_to_resource_group_relations[ resources['drg%02d_storage:/data2' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), resource_groups['drg%02d-data2' % (i + 1)][0]) + + ## Stations + for i in xrange(num_stations): + resource_to_resource_group_relations[ resources[stations[i] + 'rcu'][0] ] = (SqlKeyword('DEFAULT'), resource_groups[ stations[i] ][0]) + resource_to_resource_group_relations[ resources[stations[i] + 'tbb'][0] ] = (SqlKeyword('DEFAULT'), resource_groups[ stations[i] ][0]) + + ## RSPs + for i in xrange(num_splitter_stations): + resource_to_resource_group_relations[ resources[stations[i] + 'chan0'][0] ] = (SqlKeyword('DEFAULT'), resource_groups[stations[i] + 'RSP0'][0]) + resource_to_resource_group_relations[ resources[stations[i] + 'bw0'][0] ] = (SqlKeyword('DEFAULT'), resource_groups[stations[i] + 'RSP0'][0]) + resource_to_resource_group_relations[ resources[stations[i] + 'chan1'][0] ] = (SqlKeyword('DEFAULT'), resource_groups[stations[i] + 'RSP1'][0]) + resource_to_resource_group_relations[ resources[stations[i] + 'bw1'][0] ] = (SqlKeyword('DEFAULT'), resource_groups[stations[i] + 'RSP1'][0]) + + for i in xrange(num_non_splitter_stations): + j = i + num_splitter_stations + resource_to_resource_group_relations[ resources[stations[j] + 'chan'][0] ] = (SqlKeyword('DEFAULT'), resource_groups[stations[j] + 'RSP'][0]) + resource_to_resource_group_relations[ resources[stations[j] + 'bw'][0] ] = (SqlKeyword('DEFAULT'), resource_groups[stations[j] + 'RSP'][0]) + + if len(resource_to_resource_group_relations) != len(resources): + raise Exception('Error: resource_to_resource_group_relations and resources must have the same size!') + output.write("INSERT INTO virtual_instrument.resource_to_resource_group VALUES %s;\n" % + format_inverse_dict2(resource_to_resource_group_relations, 1)) + + + #----- resource_capacity --------------------------------------------------------------- + resource_capacities = { + # resource id : (DEFAULT, available cap, total cap) + # CEP4 total I/O bandwidth spec-ed and bench-ed at 80 GBytes/s. Achievable: see static conf max fill ratios. + resources['CEP4_bandwidth:/data'][0] : (SqlKeyword('DEFAULT'), 80*1024*1024*1024 * 8, 80*1024*1024*1024 * 8), # see prev line; bits/second + resources['CEP4_storage:/data'][0] : (SqlKeyword('DEFAULT'), 3369564904320*1024, 3369564904320*1024), # from df(1) on /cep4-fs (~3.1 PiB) + resources['dragproc_bandwidth:/data'][0] : (SqlKeyword('DEFAULT'), 450*1024*1024 * 8, 450*1024*1024 * 8), # 450 MiB/s (dd(1): 490-530) disk write to /data + resources['dragproc_storage:/data'][0] : (SqlKeyword('DEFAULT'), 23669957984256, 23669957984256), # ~22 TiB + } + + ## CEP4 cpunodes + for i in xrange(num_cpu_nodes): + # CEP4 nodes: bandwidth: FDR infiniband: iperf3: ~45.4 Gbit/s (tuned), 26 Gbit/s (untuned out of the box) + resource_capacities[ resources['cpunode%02d_bandwidth' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), 26*1000*1000*1000, 26*1000*1000*1000) # see prev line; bits/second + resource_capacities[ resources['cpunode%02d_processors' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), 24, 24) # dual 12 core (+ Hyperthr.) CPUs + + ## COBALT nodes + for i in xrange(num_cbt_nodes): + resource_capacities[ resources['cbt%03d_bandwidth' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), 2 * 26*1000*1000*1000, 2 * 26*1000*1000*1000) # see CEP4 node, but dual i/f; bits/second + resource_capacities[ resources['cbt%03d_processors' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), 24, 24) # dual 12 core (+ Hyperthr.) CPUs + + ## DRAGNET nodes (except dragproc, listed above) + for i in xrange(num_drg_nodes): + resource_capacities[ resources['drg%02d_bandwidth:/data1' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), 242*1024*1024 * 8, 242*1024*1024 * 8) # 242 MiB/s (dd(1): 288, cp(1): 225-279, another cp(1): 242) + resource_capacities[ resources['drg%02d_bandwidth:/data2' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), 242*1024*1024 * 8, 242*1024*1024 * 8) # idem + resource_capacities[ resources['drg%02d_storage:/data1' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), 7913168961536, 7913168961536) # ~7.2 TiB + resource_capacities[ resources['drg%02d_storage:/data2' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), 7913168961536, 7913168961536) # ~7.2 TiB + + ## Stations + for i in xrange(num_nl_stations): + resource_capacities[ resources[stations[i] + 'rcu'][0] ] = (SqlKeyword('DEFAULT'), 96, 96) + resource_capacities[ resources[stations[i] + 'tbb'][0] ] = (SqlKeyword('DEFAULT'), 96 * 8*1024*1024*1024, 96 * 8*1024*1024*1024) # 8 GB? + + for i in xrange(num_stations - num_nl_stations): + j = i + num_nl_stations - num_stations + resource_capacities[ resources[stations[j] + 'rcu'][0] ] = (SqlKeyword('DEFAULT'), 192, 192) + resource_capacities[ resources[stations[j] + 'tbb'][0] ] = (SqlKeyword('DEFAULT'), 192 * 8*1024*1024*1024, 192 * 8*1024*1024*1024) # 8 GB? + + ## RSPs + for i in xrange(num_splitter_stations): + resource_capacities[ resources[stations[i] + 'chan0'][0] ] = (SqlKeyword('DEFAULT'), 4 * 61 * 16, 4 * 61 * 16) # 4 RSP boards, 61 subbands/board, 16 bits/subband + resource_capacities[ resources[stations[i] + 'bw0'][0] ] = (SqlKeyword('DEFAULT'), 3*1000*1000*1000, 3*1000*1000*1000) # 3 Gbit/s + resource_capacities[ resources[stations[i] + 'chan1'][0] ] = (SqlKeyword('DEFAULT'), 4 * 61 * 16, 4 * 61 * 16) + resource_capacities[ resources[stations[i] + 'bw1'][0] ] = (SqlKeyword('DEFAULT'), 3*1000*1000*1000, 3*1000*1000*1000) + + for i in xrange(num_non_splitter_stations): + j = i + num_splitter_stations + resource_capacities[ resources[stations[j] + 'bw'][0] ] = (SqlKeyword('DEFAULT'), 3*1000*1000*1000, 3*1000*1000*1000) + resource_capacities[ resources[stations[j] + 'chan'][0] ] = (SqlKeyword('DEFAULT'), 4 * 61 * 16, 4 * 61 * 16) + + if len(resource_capacities) != len(resources): + raise Exception('Error: resource_capacities and resources must have the same size!') + output.write("INSERT INTO resource_monitoring.resource_capacity VALUES %s;\n" % + format_inverse_dict3(resource_capacities, 1)) + + + #----- resource_availability ----------------------------------------------------------- + resource_availabilities = { + # resource id : (DEFAULT, is_available) + resources['CEP4_bandwidth:/data'][0] : (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')), + resources['CEP4_storage:/data'][0] : (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')), + resources['dragproc_bandwidth:/data'][0] : (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')), + resources['dragproc_storage:/data'][0] : (SqlKeyword('DEFAULT'), SqlKeyword('FALSE')), # avoid dragproc in operations by default + } + + ## CEP4 cpunodes + for i in xrange(num_cpu_nodes): + resource_availabilities[ resources['cpunode%02d_bandwidth' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources['cpunode%02d_processors' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + + ## COBALT nodes + for i in xrange(num_cbt_nodes): + resource_availabilities[ resources['cbt%03d_bandwidth' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources['cbt%03d_processors' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + + ## DRAGNET nodes (except dragproc, listed above) + num_drg_nodes_avail_by_default = 20 # restrict to drg01 - drg20 in operations by default + for i in xrange(num_drg_nodes_avail_by_default): + resource_availabilities[ resources['drg%02d_bandwidth:/data1' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources['drg%02d_bandwidth:/data2' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources['drg%02d_storage:/data1' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources['drg%02d_storage:/data2' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + for i in xrange(num_drg_nodes_avail_by_default, num_drg_nodes): + resource_availabilities[ resources['drg%02d_bandwidth:/data1' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources['drg%02d_bandwidth:/data2' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources['drg%02d_storage:/data1' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('FALSE')) + resource_availabilities[ resources['drg%02d_storage:/data2' % (i + 1)][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('FALSE')) + + ## Stations + for i in xrange(num_stations): + resource_availabilities[ resources[stations[i] + 'rcu'][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources[stations[i] + 'tbb'][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + + ## RSPs + for i in xrange(num_splitter_stations): + resource_availabilities[ resources[stations[i] + 'chan0'][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources[stations[i] + 'bw0'][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources[stations[i] + 'chan1'][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources[stations[i] + 'bw1'][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + + for i in xrange(num_non_splitter_stations): + j = i + num_splitter_stations + resource_availabilities[ resources[stations[j] + 'chan'][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + resource_availabilities[ resources[stations[j] + 'bw'][0] ] = (SqlKeyword('DEFAULT'), SqlKeyword('TRUE')) + + if len(resource_availabilities) != len(resources): + raise Exception('Error: resource_availabilities and resources must have the same size!') + output.write("INSERT INTO resource_monitoring.resource_availability VALUES %s;\n" % + format_inverse_dict2(resource_availabilities, 1)) + + + #----- resource_group_to_resource_group ------------------------------------------------ + resource_group_to_resource_group_relations = [ + # child resource_group id , DEFAULT, parent resource_group id + (resource_groups['LOFAR'][0] , SqlKeyword('DEFAULT'), SqlKeyword('NULL')), # 'LOFAR' is the root, it has no parent + (resource_groups['CEP4'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['COBALT'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['DRAGNET'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['computenodes'][0] , SqlKeyword('DEFAULT'), resource_groups['CEP4'][0]), + (resource_groups['gpunodes'][0] , SqlKeyword('DEFAULT'), resource_groups['CEP4'][0]), + (resource_groups['drgnodes'][0] , SqlKeyword('DEFAULT'), resource_groups['DRAGNET'][0]), + (resource_groups['dragproc'][0] , SqlKeyword('DEFAULT'), resource_groups['DRAGNET'][0]), + + (resource_groups['CORE'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['REMOTE'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['INTERNATIONAL'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + + (resource_groups['SUPERTERP'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['ALL'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['NL'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['CoreSansST'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), ## Outer Core? + (resource_groups['VLBI'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['AARTFAAC'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['CORE2KM'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + (resource_groups['LORA'][0] , SqlKeyword('DEFAULT'), resource_groups['LOFAR'][0]), + ] + + ## CEP4 cpunodes + for i in xrange(num_cpu_nodes): + resource_group_to_resource_group_relations.append(( resource_groups['cpunode%02d' % (i + 1)][0], SqlKeyword('DEFAULT'), resource_groups['computenodes'][0]) ) + + ## COBALT nodes + for i in xrange(num_cbt_nodes): + resource_group_to_resource_group_relations.append(( resource_groups['cbt%03d' % (i + 1)][0], SqlKeyword('DEFAULT'), resource_groups['COBALT'][0]) ) + + ## DRAGNET nodes (except dragproc, listed above) + for i in xrange(num_drg_nodes): + resource_group_to_resource_group_relations.append(( resource_groups['drg%02d' % (i + 1)][0], SqlKeyword('DEFAULT'), resource_groups['drgnodes'][0]) ) + resource_group_to_resource_group_relations.append(( resource_groups['drg%02d-data1' % (i + 1)][0], SqlKeyword('DEFAULT'), resource_groups['drg%02d' % (i + 1)][0]) ) + resource_group_to_resource_group_relations.append(( resource_groups['drg%02d-data2' % (i + 1)][0], SqlKeyword('DEFAULT'), resource_groups['drg%02d' % (i + 1)][0]) ) + + ## Stations + for i in xrange(num_stations): + name = stations[i] + if name[0:2] == 'CS': + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['CORE'][0]) ) + elif name[0:2] == 'RS': + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['REMOTE'][0]) ) + else: + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['INTERNATIONAL'][0]) ) + + ## RSPs + for i in xrange(num_splitter_stations): + resource_group_to_resource_group_relations.append(( resource_groups[stations[i] + 'RSP0'][0], SqlKeyword('DEFAULT'), resource_groups[ stations[i] ][0]) ) + resource_group_to_resource_group_relations.append(( resource_groups[stations[i] + 'RSP1'][0], SqlKeyword('DEFAULT'), resource_groups[ stations[i] ][0]) ) + + for i in xrange(num_non_splitter_stations): + j = i + num_splitter_stations + resource_group_to_resource_group_relations.append(( resource_groups[stations[j] + 'RSP'][0], SqlKeyword('DEFAULT'), resource_groups[ stations[j] ][0]) ) + + if len(resource_group_to_resource_group_relations) != len(resource_groups): + raise Exception('Error: resource_group_to_resource_group_relations and resource_groups must have the same size!') + + #virtual resource groups below here. + + for name in ['CS001', 'CS002', 'CS003', 'CS004', 'CS005', 'CS006']: + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['SUPERTERP'][0]) ) + + for name in ['CS007', 'CS011', 'CS013', 'CS017', 'CS021', 'CS024', 'CS026', 'CS028', + 'CS030', 'CS031', 'CS032', 'CS101', 'CS103', 'CS201', 'CS301', 'CS302', + 'CS401', 'CS501']: + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['CoreSansST'][0]) ) + + for name in ['CS001', 'CS002', 'CS003', 'CS004', 'CS005', 'CS006', 'CS011', 'CS013', + 'CS017', 'CS021', 'CS032']: + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['AARTFAAC'][0]) ) + + for name in ['CS001', 'CS002', 'CS003', 'CS004', 'CS005', 'CS006', 'CS007', 'CS011', + 'CS013', 'CS017', 'CS021', 'CS024', 'CS026', 'CS028', 'CS030', 'CS031', + 'CS032', 'CS101', 'CS201', 'CS301', 'CS401', 'CS501']: + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['CORE2KM'][0]) ) + + for i in xrange(num_stations): + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['ALL'][0]) ) + name = stations[i] + if name[0:2] == 'CS': + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['NL'][0]) ) + elif name[0:2] == 'RS': + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['NL'][0]) ) + else: + resource_group_to_resource_group_relations.append(( resource_groups[name][0], SqlKeyword('DEFAULT'), resource_groups['INTERNATIONAL'][0]) ) + + #TBD LORA, VLBI + output.write("INSERT INTO virtual_instrument.resource_group_to_resource_group VALUES %s;\n" % + format_inverse_list(resource_group_to_resource_group_relations) ) + + output.write("COMMIT;\n") diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_and_populate_database.sql b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_and_populate_database.sql new file mode 100644 index 0000000000000000000000000000000000000000..6b11d2f64a5d06dcb360e886611437e8c298b955 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_and_populate_database.sql @@ -0,0 +1,7 @@ +-- master create script to create and populate the radb + +\i create_database.sql +\i add_resource_allocation_statics.sql +\i add_virtual_instrument.sql +\i add_notifications.sql +\i add_triggers.sql diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_database.sql b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_database.sql new file mode 100644 index 0000000000000000000000000000000000000000..a3275290381a554e1f74390205edb5552d4258d5 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/create_database.sql @@ -0,0 +1,472 @@ +-- Copied from JR's script, maybe we should do this? +-- DROP DATABASE IF EXISTS resourceassignment; +-- CREATE DATABASE resourceassignment +-- WITH OWNER = resourceassignment +-- ENCODING = 'UTF8' +-- TABLESPACE = pg_default +-- LC_COLLATE = 'en_US.UTF-8' +-- LC_CTYPE = 'en_US.UTF-8' +-- CONNECTION LIMIT = -1; + +-- psql resourceassignment -U resourceassignment -f create_database.sql -W + +BEGIN; + +-- only issue >warnings log messages. (only during this transaction) +SET LOCAL client_min_messages=warning; + +DROP SCHEMA IF EXISTS virtual_instrument CASCADE; +DROP SCHEMA IF EXISTS resource_monitoring CASCADE; +DROP SCHEMA IF EXISTS resource_allocation CASCADE; + +CREATE SCHEMA virtual_instrument; +CREATE SCHEMA resource_monitoring; +CREATE SCHEMA resource_allocation; + +-- This is insanity, but works, order needs to be the reverse of the CREATE TABLE statements +DROP VIEW IF EXISTS virtual_instrument.resource_view CASCADE; +DROP VIEW IF EXISTS resource_allocation.task_view CASCADE; +DROP VIEW IF EXISTS resource_allocation.resource_claim_view CASCADE; +DROP VIEW IF EXISTS resource_monitoring.resource_view CASCADE; +DROP TABLE IF EXISTS resource_allocation.config CASCADE; +DROP TABLE IF EXISTS resource_monitoring.resource_group_availability CASCADE; +DROP TABLE IF EXISTS resource_monitoring.resource_availability CASCADE; +DROP TABLE IF EXISTS resource_monitoring.resource_capacity CASCADE; +DROP TABLE IF EXISTS resource_allocation.resource_claim_property CASCADE; +DROP TABLE IF EXISTS resource_allocation.resource_claim_property_type CASCADE; +DROP TABLE IF EXISTS resource_allocation.resource_claim_property_io_type CASCADE; +DROP TABLE IF EXISTS resource_allocation.sap CASCADE; +DROP TABLE IF EXISTS resource_allocation.conflict_reason CASCADE; +DROP TABLE IF EXISTS resource_allocation.resource_claim_conflict_reason CASCADE; +DROP TABLE IF EXISTS resource_allocation.task_conflict_reason CASCADE; +DROP TABLE IF EXISTS resource_allocation.resource_claim CASCADE; +DROP TABLE IF EXISTS resource_allocation.resource_claim_status CASCADE; +DROP TABLE IF EXISTS resource_allocation.claim_session CASCADE; +DROP TABLE IF EXISTS resource_allocation.task_predecessor CASCADE; +DROP TABLE IF EXISTS resource_allocation.task CASCADE; +DROP TABLE IF EXISTS resource_allocation.specification CASCADE; +DROP TYPE IF EXISTS antennaset; +DROP TABLE IF EXISTS resource_allocation.observation_specification CASCADE; +DROP TABLE IF EXISTS resource_allocation.task_type CASCADE; +DROP TABLE IF EXISTS resource_allocation.task_status CASCADE; +DROP TABLE IF EXISTS virtual_instrument.resource_group_to_resource_group CASCADE; +DROP TABLE IF EXISTS virtual_instrument.resource_to_resource_group CASCADE; +DROP TABLE IF EXISTS virtual_instrument.resource_group CASCADE; +DROP TABLE IF EXISTS virtual_instrument.resource_group_type CASCADE; +DROP TABLE IF EXISTS virtual_instrument.resource CASCADE; +DROP TABLE IF EXISTS virtual_instrument.resource_type CASCADE; +DROP TABLE IF EXISTS virtual_instrument.unit CASCADE; +-- Would like to use this instead, but I can not get it to do something useful: SET CONSTRAINTS ALL DEFERRED; + +CREATE TABLE virtual_instrument.unit ( + id serial NOT NULL, + units text NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE virtual_instrument.unit + OWNER TO resourceassignment; + +CREATE TABLE virtual_instrument.resource_type ( + id serial NOT NULL, + name text NOT NULL, + unit_id integer NOT NULL REFERENCES virtual_instrument.unit DEFERRABLE INITIALLY IMMEDIATE, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE virtual_instrument.resource_type + OWNER TO resourceassignment; + +CREATE TABLE virtual_instrument.resource ( + id serial NOT NULL, + name text NOT NULL, + type_id integer NOT NULL REFERENCES virtual_instrument.resource_type ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE virtual_instrument.resource + OWNER TO resourceassignment; + +CREATE TABLE virtual_instrument.resource_group_type ( + id serial NOT NULL, + name text NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE virtual_instrument.resource_group_type + OWNER TO resourceassignment; + +CREATE TABLE virtual_instrument.resource_group ( + id serial NOT NULL, + name text NOT NULL, + type_id integer NOT NULL REFERENCES virtual_instrument.resource_group_type ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE virtual_instrument.resource_group + OWNER TO resourceassignment; + +CREATE TABLE virtual_instrument.resource_to_resource_group ( + id serial NOT NULL, + child_id integer NOT NULL REFERENCES virtual_instrument.resource ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + parent_id integer NOT NULL REFERENCES virtual_instrument.resource_group ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE virtual_instrument.resource_to_resource_group + OWNER TO resourceassignment; + +CREATE TABLE virtual_instrument.resource_group_to_resource_group ( + id serial NOT NULL, + child_id integer NOT NULL REFERENCES virtual_instrument.resource_group ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + parent_id integer REFERENCES virtual_instrument.resource_group ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE virtual_instrument.resource_group_to_resource_group + OWNER TO resourceassignment; + +CREATE TABLE resource_allocation.task_status ( + id serial NOT NULL, + name text NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.task_status + OWNER TO resourceassignment; + +CREATE TABLE resource_allocation.task_type ( + id serial NOT NULL, + name text NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.task_type + OWNER TO resourceassignment; + +CREATE TYPE antennaset AS ENUM('HBA Zero', 'HBA One', 'HBA Dual', 'HBA Joined', 'LBA Outer', 'LBA Inner', 'LBA Sparse Even', 'LBA Sparse Odd', 'LBA X', 'LBA Y', 'HBA Zero Inner', 'HBA One Inner', 'HBA Dual Inner', 'HBA Joined Inner'); +CREATE TABLE resource_allocation.observation_specification ( + id serial NOT NULL, + clock integer NOT NULL, + bitmode integer NOT NULL, + splitter boolean NOT NULL, + antenna antennaset NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.observation_specification + OWNER TO resourceassignment; +-- ALTER TABLE distributors -- Maybe we need a check like this? +-- ADD CONSTRAINT check_values +-- CHECK (clock = 160 OR clock = 200); + +CREATE TABLE resource_allocation.specification ( + id serial NOT NULL, + starttime timestamp, + endtime timestamp, + content text, + cluster text DEFAULT '', + observation_id integer REFERENCES resource_allocation.observation_specification ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.specification + OWNER TO resourceassignment; + +CREATE INDEX specification_cluster_idx + ON resource_allocation.specification (cluster); + +CREATE INDEX specification_starttime_endtime_idx + ON resource_allocation.specification (starttime DESC, endtime); + +-- I think we need this one? +CREATE INDEX specification_observation_id_idx + ON resource_allocation.specification (observation_id); + +CREATE TABLE resource_allocation.task ( + id serial NOT NULL, + mom_id integer UNIQUE, + otdb_id integer UNIQUE, + status_id integer NOT NULL REFERENCES resource_allocation.task_status DEFERRABLE INITIALLY IMMEDIATE, + type_id integer NOT NULL REFERENCES resource_allocation.task_type DEFERRABLE INITIALLY IMMEDIATE, + specification_id integer NOT NULL REFERENCES resource_allocation.specification ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.task + OWNER TO resourceassignment; + +CREATE INDEX task_mom_id_idx + ON resource_allocation.task (mom_id); + +CREATE INDEX task_otdb_id_idx + ON resource_allocation.task (otdb_id); + +CREATE INDEX task_status_id_idx + ON resource_allocation.task (status_id); + +CREATE INDEX task_type_id_idx + ON resource_allocation.task (type_id); + +CREATE TABLE resource_allocation.task_predecessor ( + id serial NOT NULL, + task_id integer NOT NULL REFERENCES resource_allocation.task(id) ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + predecessor_id integer NOT NULL REFERENCES resource_allocation.task(id) ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + PRIMARY KEY (id), + CONSTRAINT task_predecessor_unique UNIQUE (task_id, predecessor_id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.task_predecessor + OWNER TO resourceassignment; + +CREATE INDEX task_predecessor_predecessor_id_idx + ON resource_allocation.task_predecessor (predecessor_id); + +CREATE INDEX task_predecessor_task_id_idx + ON resource_allocation.task_predecessor (task_id); + +CREATE TABLE resource_allocation.claim_session ( + id serial NOT NULL, + username text NOT NULL, + user_id integer NOT NULL, + starttime timestamp NOT NULL, + token text NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.claim_session + OWNER TO resourceassignment; + +--until we use user management, insert one default session_id +INSERT INTO resource_allocation.claim_session(id, username, user_id, starttime, token) VALUES (1, 'anonymous', -1, '2015-04-14', 'foo'); + +CREATE TABLE resource_allocation.resource_claim_status ( + id serial NOT NULL, + name text NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.resource_claim_status + OWNER TO resourceassignment; + + +CREATE TABLE resource_allocation.resource_claim ( + id serial NOT NULL, + resource_id integer NOT NULL REFERENCES virtual_instrument.resource ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + task_id integer NOT NULL REFERENCES resource_allocation.task ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + starttime timestamp NOT NULL, + endtime timestamp NOT NULL, + 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, + claim_size bigint NOT NULL, + username text, + user_id integer, + used_rcus bit VARYING(192), + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.resource_claim + OWNER TO resourceassignment; + +CREATE INDEX resource_claim_starttime_endtime_idx + ON resource_allocation.resource_claim + USING btree + (starttime DESC, endtime); + +CREATE INDEX resource_claim_task_id_idx + ON resource_allocation.resource_claim (task_id); + +CREATE INDEX resource_claim_resource_id_idx + ON resource_allocation.resource_claim (resource_id); + +CREATE INDEX resource_claim_status_id_idx + ON resource_allocation.resource_claim (status_id); + +CREATE TABLE resource_allocation.conflict_reason ( + id serial NOT NULL, + reason text NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.conflict_reason + OWNER TO resourceassignment; + +CREATE TABLE resource_allocation.resource_claim_conflict_reason ( + id serial NOT NULL, + resource_claim_id integer NOT NULL REFERENCES resource_allocation.resource_claim ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + conflict_reason_id integer NOT NULL REFERENCES resource_allocation.conflict_reason ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.resource_claim_conflict_reason + OWNER TO resourceassignment; + +CREATE TABLE resource_allocation.task_conflict_reason ( + id serial NOT NULL, + task_id integer NOT NULL REFERENCES resource_allocation.task ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + conflict_reason_id integer NOT NULL REFERENCES resource_allocation.conflict_reason ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.task_conflict_reason + OWNER TO resourceassignment; + +CREATE TABLE resource_allocation.sap ( + id serial NOT NULL, + resource_claim_id integer NOT NULL REFERENCES resource_allocation.resource_claim ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + number int NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.sap + 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_io_type ( + id serial NOT NULL, + name text NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.resource_claim_property_io_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, + sap_id integer REFERENCES resource_allocation.sap ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + type_id integer NOT NULL REFERENCES resource_allocation.resource_claim_property_type DEFERRABLE INITIALLY IMMEDIATE, + io_type_id integer NOT NULL DEFAULT 0 REFERENCES resource_allocation.resource_claim_property_io_type DEFERRABLE INITIALLY IMMEDIATE, + value bigint 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 ( + id serial NOT NULL, + resource_id integer NOT NULL REFERENCES virtual_instrument.resource ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + available bigint NOT NULL, + total bigint NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_monitoring.resource_capacity + OWNER TO resourceassignment; + +CREATE TABLE resource_monitoring.resource_availability ( + id serial NOT NULL, + resource_id integer NOT NULL REFERENCES virtual_instrument.resource ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE, + available bool NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_monitoring.resource_availability + OWNER TO resourceassignment; + +CREATE TABLE resource_monitoring.resource_group_availability ( + id serial NOT NULL, + resource_group_id integer NOT NULL REFERENCES virtual_instrument.resource_group DEFERRABLE INITIALLY IMMEDIATE, + available bool NOT NULL, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_monitoring.resource_group_availability + OWNER TO resourceassignment; + +CREATE TABLE resource_allocation.config ( + id serial NOT NULL, + name text NOT NULL, + value text, + PRIMARY KEY (id) +) WITH (OIDS=FALSE); +ALTER TABLE resource_allocation.config + OWNER TO resourceassignment; + +-- VIEWS ---------------------------------------------- + +CREATE OR REPLACE VIEW resource_allocation.task_view AS + SELECT t.id, t.mom_id, t.otdb_id, t.status_id, t.type_id, t.specification_id, + ts.name AS status, tt.name AS type, s.starttime, s.endtime, extract(epoch from age(s.endtime, s.starttime)) as duration, s.cluster, + (SELECT array_agg(tp.predecessor_id) FROM resource_allocation.task_predecessor tp where tp.task_id=t.id) as predecessor_ids, + (SELECT array_agg(tp.task_id) FROM resource_allocation.task_predecessor tp where tp.predecessor_id=t.id) as successor_ids, + (SELECT DISTINCT ARRAY ( + SELECT _tp.predecessor_id + FROM resource_allocation.task_predecessor _tp, resource_allocation.task _t + WHERE t.status_id = 400 AND _tp.task_id = t.id AND _t.id = _tp.predecessor_id AND _t.status_id in (300, 320, 335, 1100, 1150, 1200) ) as array_agg + ) as blocked_by_ids + FROM resource_allocation.task t + JOIN resource_allocation.task_status ts ON ts.id = t.status_id + JOIN resource_allocation.task_type tt ON tt.id = t.type_id + JOIN resource_allocation.specification s ON s.id = t.specification_id; +ALTER VIEW resource_allocation.task_view + OWNER TO resourceassignment; +COMMENT ON VIEW resource_allocation.task_view + IS 'plain view on task table including task_status.name task_type.name specification.starttime and specification.endtime, duration in seconds, and the task predecessor- and successor ids'; + + +CREATE OR REPLACE VIEW resource_allocation.resource_claim_view AS + SELECT rc.*, + rcs.name AS status + FROM resource_allocation.resource_claim rc + JOIN resource_allocation.resource_claim_status rcs ON rcs.id = rc.status_id; +ALTER VIEW resource_allocation.resource_claim_view + OWNER TO resourceassignment; +COMMENT ON VIEW resource_allocation.resource_claim_view + IS 'plain view on resource_claim table, including resource_claim_status.name'; + + +CREATE OR REPLACE VIEW virtual_instrument.resource_view AS + SELECT r.id, + r.name, + r.type_id, + rt.name AS type_name, + u.id as unit_id, + u.units as unit + FROM virtual_instrument.resource r + JOIN virtual_instrument.resource_type rt ON rt.id = r.type_id + JOIN virtual_instrument.unit u ON rt.unit_id = u.id; +ALTER VIEW virtual_instrument.resource_view + OWNER TO resourceassignment; +COMMENT ON VIEW virtual_instrument.resource_view + IS 'plain view on resource table including task_type.name and units'; + + +CREATE OR REPLACE VIEW resource_allocation.resource_claim_extended_view AS + SELECT rcv.*, rv.name as resource_name, rv.type_id as resource_type_id, rv.type_name as resource_type_name + FROM resource_allocation.resource_claim_view rcv + JOIN virtual_instrument.resource_view rv ON rcv.resource_id = rv.id; +ALTER VIEW resource_allocation.resource_claim_extended_view + OWNER TO resourceassignment; +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'; + +CREATE OR REPLACE VIEW resource_allocation.resource_claim_property_view AS + SELECT rcp.id, rcp.resource_claim_id, rcp.value, rcp.sap_id, + rcp.type_id, rcpt.name AS type_name, + rcp.io_type_id, rcpiot.name AS io_type_name + FROM resource_allocation.resource_claim_property rcp + JOIN resource_allocation.resource_claim_property_type rcpt ON rcpt.id = rcp.type_id + JOIN resource_allocation.resource_claim_property_io_type rcpiot ON rcpiot.id = rcp.io_type_id; +ALTER VIEW resource_allocation.resource_claim_property_view + OWNER TO resourceassignment; +COMMENT ON VIEW resource_allocation.resource_claim_property_view + IS 'plain view on resource_claim_property table, including resource_claim_property_type.name and resource_claim_property_io_type.name'; + +CREATE OR REPLACE VIEW resource_monitoring.resource_view AS + SELECT rv.*, + rc.available AS available_capacity, + rc.total - rc.available AS used_capacity, + rc.total AS total_capacity, + ra.available AS active + FROM virtual_instrument.resource_view rv + LEFT JOIN resource_monitoring.resource_capacity rc ON rc.resource_id = rv.id + LEFT JOIN resource_monitoring.resource_availability ra ON ra.resource_id = rv.id; +ALTER VIEW resource_monitoring.resource_view + OWNER TO resourceassignment; +COMMENT ON VIEW resource_monitoring.resource_view + IS 'view on virtual_instrument.resource_view including availability and capacity'; + +CREATE OR REPLACE VIEW resource_allocation.resource_claim_conflict_reason_view AS + SELECT rccr.id, rccr.resource_claim_id, rccr.conflict_reason_id, rc.resource_id, rc.task_id, cr.reason + FROM resource_allocation.resource_claim_conflict_reason rccr + JOIN resource_allocation.conflict_reason cr on cr.id = rccr.conflict_reason_id + JOIN resource_allocation.resource_claim rc on rc.id = rccr.resource_claim_id; +ALTER VIEW resource_allocation.resource_claim_conflict_reason_view + OWNER TO resourceassignment; +COMMENT ON VIEW resource_allocation.resource_claim_conflict_reason_view + IS 'plain view on resource_claim_conflict_reason table including conflict_reason.reason'; + +CREATE OR REPLACE VIEW resource_allocation.task_conflict_reason_view AS + SELECT rccr.id, rccr.task_id, rccr.conflict_reason_id, cr.reason + FROM resource_allocation.task_conflict_reason rccr + JOIN resource_allocation.conflict_reason cr on cr.id = rccr.conflict_reason_id; +ALTER VIEW resource_allocation.task_conflict_reason_view + OWNER TO resourceassignment; +COMMENT ON VIEW resource_allocation.task_conflict_reason_view + IS 'plain view on task_conflict_reason table including conflict_reason.reason'; + +COMMIT; diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/CMakeLists.txt b/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..439c9ccb70041b11f720e5bdb0aaebdd9b4f2a6b --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/CMakeLists.txt @@ -0,0 +1,9 @@ +# $Id: CMakeLists.txt 32679 2015-10-26 09:31:56Z schaap $ +include(LofarCTest) +include(FindPythonModule) + +find_python_module(testing.postgresql) +find_python_module(mock) + +lofar_add_test(t_radb) + diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/fill_database.sql b/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/fill_database.sql deleted file mode 100644 index be1e21bca93bf916ff56e0f87a9e5ec5f8dc2eff..0000000000000000000000000000000000000000 --- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/fill_database.sql +++ /dev/null @@ -1,25 +0,0 @@ --- resourceassignment password for testing on mcu005 is the same as the password on the president's luggage +6 --- psql resourceassignment -U resourceassignment -f fill_database.sql -W -BEGIN; -INSERT INTO virtual_instrument.unit VALUES (0, 'station'),(1, 'bytes'); -INSERT INTO virtual_instrument.resource_type VALUES (0, 'station', 0),(1, 'storage', 1); -INSERT INTO virtual_instrument.resource VALUES (0, 'CS001', 0), (1,'CS002', 0), (2, 'CEP4_storage:/data', 1); -INSERT INTO virtual_instrument.resource_group_type VALUES (0, 'stations'),(1, 'cluster'); -INSERT INTO virtual_instrument.resource_group VALUES (0, 'CORE', 0),(1, 'CEP4', 1); -INSERT INTO virtual_instrument.resource_to_resource_group VALUES (0, 0, 0),(1, 1, 0), (2, 2, 1); -INSERT INTO virtual_instrument.resource_group_to_resource_group VALUES (0, 0, NULL),(1, 1, NULL); -INSERT INTO resource_allocation.task_status VALUES (0, 'SCHEDULED'),(1, 'CONFLICT'); -INSERT INTO resource_allocation.task_type VALUES (0, 'OBSERVATION'),(1, 'PIPELINE'); -INSERT INTO resource_allocation.specification VALUES (0, '2015-11-05 12:00:00', '2015-11-05 12:30:00', 'key=value'), -(1, '2015-11-05 13:00:00', '2015-11-05 14:00:00', 'key=1'); -INSERT INTO resource_allocation.task VALUES (0, 654321, 12345, 0, 0, 0),(1, 765432, 2654321, 1, 1, 1); -INSERT INTO resource_allocation.claim_session VALUES (0, 'renting', 0, '2015-11-05 12:00:00', 'renting-token'), -(1, 'paulus', 1, '2015-11-05 14:00:00', 'paulus-token'); -INSERT INTO resource_allocation.resource_claim_status VALUES (0, 'CLAIMED'),(1, 'ALLOCATED'); -INSERT INTO resource_allocation.resource_claim VALUES (0, 0, 0, '2015-11-05 12:00:00', '2015-11-05 12:30:00', 0, 0, 1), -(1, 2, 1, '2015-11-05 13:00:00', '2015-11-05 14:00:00', 1, 1, 1234); -INSERT INTO resource_monitoring.resource_capacity VALUES (0, 0, 1, 1), (1, 1, 1,1 ), (2, 2, 15000, 100000); -INSERT INTO resource_monitoring.resource_availability VALUES (0, 0, TRUE), (1, 1, TRUE), (2, 2, TRUE); -INSERT INTO resource_monitoring.resource_group_availability VALUES (0, 0, TRUE), (1, 1, TRUE); -INSERT INTO resource_allocation.config VALUES (0, 'max_fill_ratio_CEP4_storage', '0.85'), (1, 'claim_timeout', '172800'); -COMMIT; diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.py new file mode 100755 index 0000000000000000000000000000000000000000..5f132bb5abb51362eaef7d13532624c5306367e6 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.py @@ -0,0 +1,268 @@ +#!/usr/bin/python + +# Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy) +# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands +# +# This file is part of the LOFAR software suite. +# The LOFAR software suite is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# The LOFAR software suite is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. + +# $Id: $ +import unittest +import testing.postgresql +import psycopg2 +import os +from dateutil import parser +import logging + +logger = logging.getLogger(__name__) + +try: + import mock +except ImportError as e: + print str(e) + print 'Please install python package mock: sudo pip install mock' + exit(3) # special lofar test exit code: skipped test + +try: + import testing.postgresql +except ImportError as e: + print str(e) + print 'Please install python package testing.postgresql: sudo pip install testing.postgresql' + exit(3) # special lofar test exit code: skipped test + +from lofar.common.dbcredentials import Credentials +from lofar.sas.resourceassignment.database.radb import RADatabase +from lofar.common.postgres import PostgresListener + + +class ResourceAssignmentDatabaseTest(unittest.TestCase): + # todo: test shared db to improve test speed + # share the generated database for faster tests + # Postgresql = testing.postgresql.PostgresqlFactory(cache_initialized_db=True) + + # These are applied in given order to set up test db + # Note: cannot use create_and_populate_database.sql since '\i' is not understood by cursor.execute() + sql_basepath = os.environ['LOFARROOT'] + "/share/radb/sql/" + sql_createdb_paths = [sql_basepath + "create_database.sql", + sql_basepath + "/add_resource_allocation_statics.sql", + sql_basepath + "/add_virtual_instrument.sql", + sql_basepath + "/add_notifications.sql", + sql_basepath + "/add_triggers.sql" + ] + + def setUp(self): + # set up postgres database + logger.info('setting up test RA database...') + + self.postgresql = testing.postgresql.Postgresql() + # self.Postgresql() + self.connection = psycopg2.connect(**self.postgresql.dsn()) + + database_credentials = Credentials() + database_credentials.host = self.postgresql.dsn()['host'] + database_credentials.database = self.postgresql.dsn()['database'] + database_credentials.port = self.postgresql.dsn()['port'] + database_credentials.user = 'resourceassignment' + database_credentials.password = 'blabla' # cannot be empty... + + # Note: NOSUPERUSER currently raises "permission denied for schema virtual_instrument" + # Maybe we want to sort out user creation and proper permissions in the sql scripts? + query = "CREATE USER %s WITH SUPERUSER PASSWORD '%s'" % ( + database_credentials.user, + database_credentials.password) + self._execute_query(query) + + for sql_path in self.sql_createdb_paths: + with open(sql_path) as sql: # cursor.execute() does not accept '\i' + self._execute_query(sql.read()) + + logger.info('...finished setting up test RA database') + + # reconnect with useradministration role for tests + self.connection.close() + self.connection = psycopg2.connect(host=database_credentials.host, + user=database_credentials.user, + password=database_credentials.password, + dbname=database_credentials.database, + port=database_credentials.port) + + # set up PostgresListener for notifications: + self.listener = PostgresListener(host=database_credentials.host, + username=database_credentials.user, + password=database_credentials.password, + database=database_credentials.database, + port=database_credentials.port) + + # set up radb python module + self.radb = RADatabase(database_credentials, log_queries=True) + + def tearDown(self): + self.connection.close() + self.postgresql.stop() + # self.Postgresql.clear_cache() # todo: use this when using shared db instead of stop(), or remove. + + def _execute_query(self, query, fetch=False): + cursor = self.connection.cursor() + cursor.execute(query) + ret = None + if fetch: + ret = cursor.fetchall() + cursor.close() + self.connection.commit() + return ret + + # --- tests start here + + # + # integrity tests of postgres database itself + # + # Note: These are meant to make sure the setup generally works and all sql scripts were applied. + # I don't see much benefit in full coverage here since it should be all be tested through RADataBase functionality. + # Of course new tests can be added here where db functionality like triggers should be tested separately from the + # Python part of the job. + + # database created? + def test_select_tables_contains_tables_for_each_schema(self): + query = "SELECT table_schema,table_name FROM information_schema.tables" + fetch = self._execute_query(query, fetch=True) + self.assertTrue('resource_allocation' in str(fetch)) + self.assertTrue('resource_monitoring' in str(fetch)) + self.assertTrue('virtual_instrument' in str(fetch)) + + # resource allocation_statics there? + def test_select_task_types_contains_obervation(self): + query = "SELECT * FROM resource_allocation.task_type" + fetch = self._execute_query(query, fetch=True) + self.assertTrue('observation' in str(fetch)) + + # virtual instrument there? + def test_select_virtualinstrument_units_contain_rcuboard(self): + query = "SELECT * FROM virtual_instrument.unit" + fetch = self._execute_query(query, fetch=True) + self.assertTrue('rcu_board' in str(fetch)) + + def _insert_test_spec(self, + starttime='2017-05-10 13:00:00', + endtime='2017-05-10 14:00:00', + content='testcontent', + cluster='CEP4'): + query = "INSERT INTO resource_allocation.specification (starttime, endtime, content, cluster) " \ + "VALUES ('%s', '%s', '%s', '%s') RETURNING id" % (starttime, endtime, content, cluster) + res = self._execute_query(query, fetch=True) + return res[0][0] + + def test_insert_specification_creates_new_entry(self): + # insert spec + content = 'testcontent' + ident = self._insert_test_spec(content=content) + + # check it is there + query = "SELECT content FROM resource_allocation.specification WHERE id=%s" % ident + fetch = self._execute_query(query, fetch=True) + self.assertTrue(content in str(fetch)) + + def test_update_specification_changes_entry(self): + # insert spec + ident = self._insert_test_spec() + + # update existing spec content + newcontent = 'testcontent_new' + query = "UPDATE resource_allocation.specification SET (content) = ('%s')" % newcontent + self._execute_query(query) + + # check updated content + query = "SELECT content FROM resource_allocation.specification WHERE id=%s" % ident + fetch = self._execute_query(query, fetch=True) + self.assertTrue(newcontent in str(fetch)) + + def test_delete_specification(self): + # insert spec + content = 'deletecontent' + ident = self._insert_test_spec(content=content) + + # make sure it's there + query = "SELECT content FROM resource_allocation.specification WHERE id=%s" % ident + fetch = self._execute_query(query, fetch=True) + self.assertTrue(content in str(fetch)) + + # delete testspec again + query = "DELETE FROM resource_allocation.specification WHERE id = %s" % ident + self._execute_query(query) + + # make sure it's gone + query = "SELECT content FROM resource_allocation.specification WHERE id=%s" % ident + fetch = self._execute_query(query, fetch=True) + self.assertFalse(content in str(fetch)) + + # triggers in place? + def test_insert_specification_swaps_startendtimes_if_needed(self): + # insert spec + starttime = '2017-05-10 12:00:00' + endtime = '2017-05-10 10:00:00' + ident = self._insert_test_spec(starttime=starttime, endtime=endtime) + + # check endtime in db is old starttime + query = "SELECT endtime FROM resource_allocation.specification WHERE id=%s" % ident + fetch = self._execute_query(query, fetch=True) + self.assertTrue(parser.parse(starttime) == fetch[0][0]) + + # notifications in place? + def test_insert_task_triggers_notification(self): + # insert specification to not raise INtegrityError + ident = self._insert_test_spec() + + # listen on notification + cursor = self.connection.cursor() + cursor.execute("LISTEN %s;", (psycopg2.extensions.AsIs('task_insert'),)) + + # todo: fix this and use this instead to listen for notifications. + # todo: ...Problem: For some reason callback function is not called. + # set up listener in a way we can check it was called + # callback = mock.Mock() + # callback.listen.return_value = 42 + # self.listener.subscribe('task_insert', callback.listen) + + # trigger notification + query = "INSERT INTO resource_allocation.task (mom_id, otdb_id, status_id, type_id, specification_id)" \ + "VALUES (%s, %s, %s, %s, %s)" % (1, 1, 200, 0, ident) + self._execute_query(query) + + # wait for notification + notification = '' + self.connection.poll() + while self.connection.notifies: + try: + notification = self.connection.notifies.pop(0) + break + except Exception: + pass + + self.assertTrue('task_insert' in str(notification)) + + # todo: fix listener and use instead of polling: + # callback.listen.assert_called() + + # + # radb functionality tests + # + # + + def test_getTaskStatuses_contains_scheduled(self): + stat = self.radb.getTaskStatuses() + self.assertTrue('scheduled' in str(stat)) + + +if __name__ == "__main__": + logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO) + unittest.main() diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.run b/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.run new file mode 100755 index 0000000000000000000000000000000000000000..7895b4e99028fba6866f5d359567fe3a9483f912 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.run @@ -0,0 +1,5 @@ +#!/bin/bash + +# Run the unit test +source python-coverage.sh +python_coverage_test "ResourceAssignmentDatabase/*" t_radb.py diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.sh b/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.sh new file mode 100755 index 0000000000000000000000000000000000000000..d7aa7a173a26cde54d69dbbfffd7d825a2450292 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/tests/t_radb.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +./runctest.sh t_radb