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
Show more breadcrumbs
genotoul-bioinfo
d-genies
D-GENIES
Commits
8d2959f6
Commit
8d2959f6
authored
7 years ago
by
Floreal Cabanettes
Browse files
Options
Downloads
Patches
Plain Diff
Fix clean cron def
parent
9aada461
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dgenies/lib/crons.py
+12
-6
12 additions, 6 deletions
src/dgenies/lib/crons.py
with
12 additions
and
6 deletions
src/dgenies/lib/crons.py
+
12
−
6
View file @
8d2959f6
...
@@ -34,6 +34,14 @@ class Crons:
...
@@ -34,6 +34,14 @@ class Crons:
self
.
init_clean_cron
()
self
.
init_clean_cron
()
self
.
init_launch_local_cron
()
self
.
init_launch_local_cron
()
@staticmethod
def
_get_python_exec
():
pyexec
=
sys
.
executable
match
=
re
.
match
(
r
"
^(.+)/lib/(python[^/]+)/((site-packages/bin/python)|())$
"
,
pyexec
)
if
match
:
pyexec
=
"
%s/bin/%s
"
%
(
match
.
group
(
1
),
match
.
group
(
2
))
return
pyexec
def
init_clean_cron
(
self
):
def
init_clean_cron
(
self
):
"""
"""
Clean cron is launched at 1h00am each day
Clean cron is launched at 1h00am each day
...
@@ -41,8 +49,9 @@ class Crons:
...
@@ -41,8 +49,9 @@ class Crons:
clean_time
=
self
.
config
.
cron_clean_time
clean_time
=
self
.
config
.
cron_clean_time
clean_freq
=
self
.
config
.
cron_clean_freq
clean_freq
=
self
.
config
.
cron_clean_freq
if
self
.
base_dir
is
not
None
:
if
self
.
base_dir
is
not
None
:
job
=
self
.
my_cron
.
new
(
sys
.
executable
+
job
=
self
.
my_cron
.
new
(
self
.
_get_python_exec
()
+
"
{0}/bin/clean_jobs.py > {0}/clean.log 2>&1
"
.
format
(
self
.
config
.
log_dir
),
"
{0}/bin/clean_jobs.py > {1}/clean.log 2>&1
"
.
format
(
self
.
base_dir
,
self
.
config
.
log_dir
),
comment
=
"
dgenies
"
)
comment
=
"
dgenies
"
)
job
.
day
.
every
(
clean_freq
)
job
.
day
.
every
(
clean_freq
)
job
.
hour
.
on
(
clean_time
[
0
])
job
.
hour
.
on
(
clean_time
[
0
])
...
@@ -57,10 +66,7 @@ class Crons:
...
@@ -57,10 +66,7 @@ class Crons:
:return:
:return:
"""
"""
if
self
.
base_dir
is
not
None
:
if
self
.
base_dir
is
not
None
:
pyexec
=
sys
.
executable
pyexec
=
self
.
_get_python_exec
()
match
=
re
.
match
(
r
"
^(.+)/lib/(python[^/]+)/((site-packages/bin/python)|())$
"
,
pyexec
)
if
match
:
pyexec
=
"
%s/bin/%s
"
%
(
match
.
group
(
1
),
match
.
group
(
2
))
logs
=
os
.
path
.
join
(
self
.
config
.
log_dir
,
"
local_scheduler.log
"
)
if
self
.
debug
else
"
/dev/null
"
logs
=
os
.
path
.
join
(
self
.
config
.
log_dir
,
"
local_scheduler.log
"
)
if
self
.
debug
else
"
/dev/null
"
job
=
self
.
my_cron
.
new
(
"
{0}/bin/start_local_scheduler.sh {0} {1} {2} {3} > /dev/null 2>&1 &
"
.
job
=
self
.
my_cron
.
new
(
"
{0}/bin/start_local_scheduler.sh {0} {1} {2} {3} > /dev/null 2>&1 &
"
.
format
(
self
.
base_dir
,
pyexec
,
self
.
local_scheduler_pid_file
,
logs
),
format
(
self
.
base_dir
,
pyexec
,
self
.
local_scheduler_pid_file
,
logs
),
...
...
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