Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CastorScript
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
atlas-tdaq-software
CastorScript
Commits
0b09d09f
Commit
0b09d09f
authored
6 years ago
by
Jonas
Browse files
Options
Downloads
Patches
Plain Diff
Added config parameters for IS + Test
parent
2a0b1d97
No related branches found
Branches containing commit
No related tags found
1 merge request
!29
Resolve "Initial Publish uptime of CS instance to IS"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Configs/template.cfg
+14
-0
14 additions, 0 deletions
Configs/template.cfg
Script/UnitTests/ConfigParser_Test.py
+36
-2
36 additions, 2 deletions
Script/UnitTests/ConfigParser_Test.py
Script/cs/Tools/ConfigParser.py
+25
-0
25 additions, 0 deletions
Script/cs/Tools/ConfigParser.py
with
75 additions
and
2 deletions
Configs/template.cfg
+
14
−
0
View file @
0b09d09f
...
...
@@ -50,6 +50,20 @@ ers_warning: "mts"
ers_error:
"mts"
ers_debug:
"mts"
########## VARIABLES FOR IS ##########
# On / Off switch for IS
IS_enabled:
False
# Partition to publish to
IS_partition:
"initial"
# IS Server to publish to
IS_server:
"RunParams"
# Publication Period (time between updates)
IS_publication_period:
5
########## METADATA DATABASE ##########
# Oracle connection string
...
...
This diff is collapsed.
Click to expand it.
Script/UnitTests/ConfigParser_Test.py
+
36
−
2
View file @
0b09d09f
...
...
@@ -17,12 +17,46 @@ class TestConfigHolder(unittest.TestCase):
def
setUpClass
(
self
):
self
.
thisDir
=
os
.
path
.
dirname
(
__file__
)
self
.
templateName
=
"
template.cfg
"
self
.
cfgTemplate
=
os
.
path
.
abspath
(
os
.
path
.
join
(
self
.
thisDir
,
"
../../Configs/
"
+
self
.
templateName
))
self
.
cfgTemplatePath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
self
.
thisDir
,
"
../../Configs/
"
+
self
.
templateName
))
self
.
cfgTest_path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
self
.
thisDir
,
"
funcTestConf.cfg
"
))
@classmethod
def
tearDownClass
(
self
):
os
.
remove
(
self
.
cfgTest_path
)
def
test_it_should_save_config_file_name
(
self
):
cfg
=
ConfigHolder
(
self
.
cfgTemplate
)
cfg
=
ConfigHolder
(
self
.
cfgTemplate
Path
)
self
.
assertEquals
(
self
.
templateName
,
cfg
.
FileName
)
def
test_it_should_save_IS_parameters
(
self
):
cfgTemplateFile
=
open
(
self
.
cfgTemplatePath
,
"
r
"
)
# I make a new file
cfgTest
=
open
(
self
.
cfgTest_path
,
"
w
"
)
# And I copy the content and replaces the directories with my own dirs
custom_cfg_lines
=
{
"
IS_enabled:
"
:
"
IS_enabled: {}
\n
"
.
format
(
True
),
"
IS_partition:
"
:
"
IS_partition:
\'
{}
\'\n
"
.
format
(
"
testPartition
"
),
"
IS_server:
"
:
"
IS_server:
\'
{}
\'\n
"
.
format
(
"
testServer
"
),
"
IS_publication_period:
"
:
"
IS_publication_period: {}
\n
"
.
format
(
200
),
}
# And I copy the content and replaces the directories with my own dirs
for
line
in
cfgTemplateFile
:
for
key
,
value
in
custom_cfg_lines
.
iteritems
():
if
line
.
find
(
key
)
is
not
-
1
:
line
=
value
cfgTest
.
write
(
line
)
cfgTest
.
close
()
cfgTemplateFile
.
close
()
cfg
=
ConfigHolder
(
self
.
cfgTest_path
)
self
.
assertEquals
(
True
,
cfg
.
IS_enabled
)
self
.
assertEquals
(
"
testPartition
"
,
cfg
.
IS_partition
)
self
.
assertEquals
(
"
testServer
"
,
cfg
.
IS_server
)
self
.
assertEquals
(
200
,
cfg
.
IS_publication_period
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
...
...
This diff is collapsed.
Click to expand it.
Script/cs/Tools/ConfigParser.py
+
25
−
0
View file @
0b09d09f
...
...
@@ -118,6 +118,31 @@ class ConfigHolder:
except
AttributeError
:
self
.
ers_debug
=
''
########## Variables for IS ##########
# On / Off switch for ERS
try
:
self
.
IS_enabled
=
cfg
.
IS_enabled
except
AttributeError
:
self
.
IS_enabled
=
False
# Partition to publish to
try
:
self
.
IS_partition
=
cfg
.
IS_partition
except
AttributeError
:
self
.
IS_partition
=
'
initial
'
# IS Server to publish to
try
:
self
.
IS_server
=
cfg
.
IS_server
except
AttributeError
:
self
.
IS_server
=
'
RunParams
'
# Publication Period (seconds between updates)
try
:
self
.
IS_publication_period
=
cfg
.
IS_publication_period
except
AttributeError
:
self
.
IS_publication_period
=
5
########## METADATA DATABASE ##########
...
...
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