Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
20958982
Commit
20958982
authored
16 years ago
by
Ruud Overeem
Browse files
Options
Downloads
Patches
Plain Diff
Bug 1189: Added function for MACScheduler to produce the planned- active- and finished list.
parent
25f53137
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitattributes
+1
-0
1 addition, 0 deletions
.gitattributes
SAS/OTDB/sql/getTreeGroup_func.sql
+100
-0
100 additions, 0 deletions
SAS/OTDB/sql/getTreeGroup_func.sql
with
101 additions
and
0 deletions
.gitattributes
+
1
−
0
View file @
20958982
...
...
@@ -1161,6 +1161,7 @@ SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/userpanels/TBBConfigPanel.form
SAS/OTB/jOTDB2/.cvsignore -text
SAS/OTB/jOTDB2/make_jar.sh -text svneol=native#application/octet-stream
SAS/OTDB/sql/fresh_sas001_database.sh -text
SAS/OTDB/sql/getTreeGroup_func.sql -text
SDP/SPP/DSP[!!-~]BUILDER/myfilterbank.mdl -text
SDP/SPP/MATLAB/gui2/gui_qt.fig -text svneol=unset#unset
SDP/SPP/VHDL/FFT/aukfft_acmxaa.tdf -text svneol=unset#unset
...
...
This diff is collapsed.
Click to expand it.
SAS/OTDB/sql/getTreeGroup_func.sql
0 → 100644
+
100
−
0
View file @
20958982
--
-- getTreesInPeriod.sql: function for getting treeinfo from the OTDB
--
-- Copyright (C) 2005
-- ASTRON (Netherlands Foundation for Research in Astronomy)
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
--
-- This program 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 2 of the License, or
-- (at your option) any later version.
--
-- This program 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 this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- $Id: getExecutableTrees_func.sql 8438 2006-05-18 19:16:37Z overeem $
--
--
-- getTreesInPeriod (groupType, periodInMinutes)
--
-- groupType = 1: get all trees that are scheduled to start in the period: now till now+period
-- 2: get all trees with starttime <=now and stoptime > now ; period param is ignored
-- 3: get all trees with stoptime in the period: now-period till now
--
-- With this function we can get the planned, active or finished trees from the database.
--
-- Authorisation: none
--
-- Tables: otdbtree read
-- otdbuser read
-- campaign read
--
-- Types: treeInfo
--
CREATE
OR
REPLACE
FUNCTION
getTreeGroup
(
INT
,
INT
)
RETURNS
SETOF
treeInfo
AS
'
DECLARE
vRecord RECORD;
TSscheduled CONSTANT INT2 := 400;
TSfinished CONSTANT INT2 := 1000;
TThierarchy CONSTANT INT2 := 30;
TCoperational CONSTANT INT2 := 3;
vQuery TEXT;
BEGIN
vQuery :=
\'\'
;
IF $1 = 1 THEN
vQuery :=
\'
AND t.state =
\'
|| TSscheduled;
-- vQuery := vQuery ||
\'
AND t.starttime < now()+interval
\'
|| chr(39) || $2 ||
\'
minutes
\'
|| chr(39);
vQuery := vQuery ||
\'
AND t.starttime >= now() AND t.starttime < now()+interval
\'
|| chr(39) || $2 ||
\'
minutes
\'
|| chr(39);
ELSE
IF $1 = 2 THEN
vQuery :=
\'
AND t.starttime <= now() AND t.stoptime > now()
\'
;
ELSE
IF $1 = 3 THEN
vQuery :=
\'
AND t.state >=
\'
|| TSfinished;
vQuery := vQuery ||
\'
AND t.stoptime > now()-interval
\'
|| chr(39) || $2 ||
\'
minutes
\'
|| chr(39);
ELSE
RAISE EXCEPTION
\'
groupType must be 1,2 or 3 not %
\'
, $1;
END IF;
END IF;
END IF;
-- do selection
FOR vRecord IN EXECUTE
\'
SELECT t.treeID,
t.momID,
t.classif,
u.username,
t.d_creation,
t.treetype,
t.state,
t.originID,
c.name,
t.starttime,
t.stoptime,
t.description
FROM OTDBtree t
INNER JOIN OTDBuser u ON t.creator = u.userid
INNER JOIN campaign c ON c.ID = t.campaign
WHERE t.treetype = 30
AND t.classif = 3
\'
|| vQuery ||
\'
ORDER BY t.starttime, t.treeID
\'
LOOP
RETURN NEXT vRecord;
END LOOP;
RETURN;
END
'
LANGUAGE
plpgsql
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment