Skip to content

Commit

Permalink
Merge pull request #79 from PanDAWMS/eddiedev
Browse files Browse the repository at this point in the history
Fixes [ATLASPANDA-1099]: Postgres update to 0.0.19
  • Loading branch information
EdwardKaravakis authored Sep 4, 2024
2 parents 96790db + 9d8e7d5 commit 3ef032a
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 4 deletions.
80 changes: 80 additions & 0 deletions schema/postgres/sqls/patches/0.0.19.patch.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
-- patch to be used to upgrade from version 0.0.18
ALTER TABLE doma_panda.mv_jobsactive4_stats ADD COLUMN num_of_cores bigint;
COMMENT ON COLUMN doma_panda.mv_jobsactive4_stats.num_of_cores IS E'Number of cores computed by grouping all set of attributes(columns) listed in that column';

CREATE OR REPLACE PROCEDURE doma_panda.update_jobsactive_stats () AS $body$
BEGIN

-- ver 1.3 , last modified on 2nd September 2024
-- added NUM_OF_CORES columns
-- ver 1.2 , last modified on 2th July 2013
-- added VO and WORKQUEUE_ID columns
-- to easy identify the session and better view on resource usage by setting a dedicated module for the PanDA jobs
--DBMS_APPLICATION_INFO.SET_MODULE( module_name => 'PanDA scheduler job', action_name => 'Aggregates data for the active jobs!');
--DBMS_APPLICATION_INFO.SET_CLIENT_INFO( client_info => sys_context('userenv', 'host') || ' ( ' || sys_context('userenv', 'ip_address') || ' )' );


DELETE from doma_panda.mv_jobsactive4_stats;

INSERT INTO doma_panda.mv_jobsactive4_stats(CUR_DATE,
CLOUD,
COMPUTINGSITE,
COUNTRYGROUP,
WORKINGGROUP,
RELOCATIONFLAG,
JOBSTATUS,
PROCESSINGTYPE,
PRODSOURCELABEL,
CURRENTPRIORITY,
VO,
WORKQUEUE_ID,
NUM_OF_JOBS,
NUM_OF_CORES
)
SELECT
clock_timestamp(),
cloud,
computingSite,
countrygroup,
workinggroup,
relocationflag,
jobStatus,
processingType,
prodSourceLabel,
TRUNC(currentPriority, -1) AS currentPriority,
VO,
WORKQUEUE_ID,
COUNT(*) AS num_of_jobs,
SUM(COALESCE(actualcorecount, corecount)) AS num_of_cores
FROM doma_panda.jobsActive4
GROUP BY
clock_timestamp(),
cloud,
computingSite,
countrygroup,
workinggroup,
relocationflag,
jobStatus,
processingType,
prodSourceLabel,
TRUNC(currentPriority, -1),
VO,
WORKQUEUE_ID;
--COMMIT;

--DBMS_APPLICATION_INFO.SET_MODULE( module_name => null, action_name => null);
--DBMS_APPLICATION_INFO.SET_CLIENT_INFO( client_info => null);

end;
$body$
LANGUAGE PLPGSQL
SECURITY DEFINER
;
ALTER PROCEDURE update_jobsactive_stats () OWNER TO panda;


-- Update versions
UPDATE doma_panda.pandadb_version SET major=0, minor=0, patch=19 where component='JEDI';
UPDATE doma_panda.pandadb_version SET major=0, minor=0, patch=19 where component='SERVER';
COMMIT;

8 changes: 6 additions & 2 deletions schema/postgres/sqls/pg_PANDA_SCHEDULER_JOBS.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,8 @@ ALTER PROCEDURE tasks_statuslog_sl_window (DAYS_OFFSET bigint) owner TO panda;
CREATE OR REPLACE PROCEDURE doma_panda.update_jobsactive_stats () AS $body$
BEGIN

-- ver 1.3 , last modified on 2nd September 2024
-- added NUM_OF_CORES columns
-- ver 1.2 , last modified on 2th July 2013
-- added VO and WORKQUEUE_ID columns
-- to easy identify the session and better view on resource usage by setting a dedicated module for the PanDA jobs
Expand All @@ -1242,7 +1244,8 @@ INSERT INTO mv_jobsactive4_stats(CUR_DATE,
CURRENTPRIORITY,
VO,
WORKQUEUE_ID,
NUM_OF_JOBS
NUM_OF_JOBS,
NUM_OF_CORES
)
SELECT
clock_timestamp(),
Expand All @@ -1257,7 +1260,8 @@ INSERT INTO mv_jobsactive4_stats(CUR_DATE,
TRUNC(currentPriority, -1) AS currentPriority,
VO,
WORKQUEUE_ID,
COUNT(*) AS num_of_jobs
COUNT(*) AS num_of_jobs,
SUM(COALESCE(actualcorecount, corecount)) AS num_of_cores
FROM jobsActive4
GROUP BY
clock_timestamp(),
Expand Down
4 changes: 3 additions & 1 deletion schema/postgres/sqls/pg_PANDA_TABLE.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2355,7 +2355,8 @@ CREATE TABLE mv_jobsactive4_stats (
currentpriority bigint,
num_of_jobs bigint,
vo varchar(32),
workqueue_id integer
workqueue_id integer,
num_of_cores bigint
) ;
COMMENT ON TABLE mv_jobsactive4_stats IS E'Table (was from Materialized view before, but was not reliable) which collects aggregated data on set of attributes(columns). The data is read from the JOBSACTIVE4 table by an Oracle scheduler job. The refresh interval is 2 min';
COMMENT ON COLUMN mv_jobsactive4_stats.cloud IS E'cloud (associated with Tier 1) where the job is submitted to';
Expand All @@ -2369,6 +2370,7 @@ COMMENT ON COLUMN mv_jobsactive4_stats.processingtype IS E'type of the job comes
COMMENT ON COLUMN mv_jobsactive4_stats.prodsourcelabel IS E'activity name of the name such as managed, user, and ddm';
COMMENT ON COLUMN mv_jobsactive4_stats.relocationflag IS E'flag for submitting jobs to a single site. I.e. the brokerage is bypassed';
COMMENT ON COLUMN mv_jobsactive4_stats.workinggroup IS E'working group name';
COMMENT ON COLUMN mv_jobsactive4_stats.num_of_cores IS E'Number of cores computed by grouping all set of attributes(columns) listed in that column';
ALTER TABLE mv_jobsactive4_stats OWNER TO panda;
ALTER TABLE mv_jobsactive4_stats ALTER COLUMN JOBSTATUS SET NOT NULL;

Expand Down
2 changes: 1 addition & 1 deletion schema/postgres/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.18
0.0.19

0 comments on commit 3ef032a

Please sign in to comment.