Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D-GENIES
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
genotoul-bioinfo
d-genies
D-GENIES
Commits
bef01341
Commit
bef01341
authored
7 years ago
by
Floreal Cabanettes
Browse files
Options
Downloads
Patches
Plain Diff
Make applications.properties genric and set it as example, Fixed
#30
parent
3a7bb4fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
application.properties.example
+12
-0
12 additions, 0 deletions
application.properties.example
srv/config_reader.py
+15
-5
15 additions, 5 deletions
srv/config_reader.py
with
28 additions
and
5 deletions
.gitignore
+
1
−
0
View file @
bef01341
*/__pycache__
.idea
srv/database.sqlite
application.properties
This diff is collapsed.
Click to expand it.
application.properties
→
application.properties
.example
+
12
−
0
View file @
bef01341
[global]
upload_folder
=
/home/fcabanettes/public_html
/tmp
data_folder
=
/home/fcabanettes/public_html/test
upload_folder = /tmp
data_folder =
###PROGRAM###/data
# batch system type: local, sge, slurm
batch_system_type = local
threads = 4
[softwares]
minimap2
=
/home/fcabanettes/minimap2/minimap2
minimap2 =
###DEFAULT###
[database]
sqlite_file
=
/home/fcabanettes/dgenies
/srv/database.sqlite
sqlite_file =
###PROGRAM###
/srv/database.sqlite
This diff is collapsed.
Click to expand it.
srv/config_reader.py
+
15
−
5
View file @
bef01341
...
...
@@ -12,18 +12,27 @@ class AppConfigReader(object):
def
__init__
(
self
):
"""
"""
config_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
inspect
.
getfile
(
self
.
__class__
)),
self
.
CONFIG_FILE_PATH
)
if
not
os
.
path
.
exists
(
config_file
):
raise
FileNotFoundError
(
"
ERROR: application.properties not found. Please copy the example file and check
"
"
properties are correct for you!
"
)
self
.
reader
=
RawConfigParser
()
self
.
reader
.
read
(
os
.
path
.
join
(
os
.
path
.
dirname
(
inspect
.
getfile
(
self
.
__class__
)),
self
.
CONFIG_FILE_PATH
))
self
.
reader
.
read
(
config_file
)
@staticmethod
def
replace_vars
(
path
):
return
path
.
replace
(
"
###USER###
"
,
os
.
path
.
expanduser
(
"
~
"
))
\
.
replace
(
"
###PROGRAM###
"
,
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))))
def
get_upload_folder
(
self
):
try
:
return
self
.
reader
.
get
(
"
global
"
,
"
upload_folder
"
)
return
self
.
replace_vars
(
self
.
reader
.
get
(
"
global
"
,
"
upload_folder
"
)
)
except
NoOptionError
:
raise
Exception
(
"
No upload folder found in application.properties (global section)
"
)
def
get_app_data
(
self
):
try
:
return
self
.
reader
.
get
(
"
global
"
,
"
data_folder
"
)
return
self
.
replace_vars
(
self
.
reader
.
get
(
"
global
"
,
"
data_folder
"
)
)
except
NoOptionError
:
raise
Exception
(
"
No data folder found in application.properties (global section)
"
)
...
...
@@ -41,12 +50,13 @@ class AppConfigReader(object):
def
get_minimap2_exec
(
self
):
try
:
return
self
.
reader
.
get
(
"
softwares
"
,
"
minimap2
"
)
entry
=
self
.
reader
.
get
(
"
softwares
"
,
"
minimap2
"
)
return
entry
if
entry
!=
"
###DEFAULT###
"
else
"
minimap2
"
except
NoOptionError
:
return
"
minimap2
"
def
get_database
(
self
):
try
:
return
self
.
reader
.
get
(
"
database
"
,
"
sqlite_file
"
)
return
self
.
replace_vars
(
self
.
reader
.
get
(
"
database
"
,
"
sqlite_file
"
)
)
except
NoOptionError
:
return
"
:memory:
"
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