Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
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
IGWN Computing and Software
GraceDB
GraceDB Server
Commits
54e3519c
Commit
54e3519c
authored
10 years ago
by
Branson Craig Stephens
Browse files
Options
Downloads
Patches
Plain Diff
Added management command to scrub mdc events.
parent
f992d59e
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
gracedb/management/commands/scrub_mdc_events.py
+39
-0
39 additions, 0 deletions
gracedb/management/commands/scrub_mdc_events.py
with
39 additions
and
0 deletions
gracedb/management/commands/scrub_mdc_events.py
0 → 100644
+
39
−
0
View file @
54e3519c
import
os
,
shutil
from
django.core.management.base
import
NoArgsCommand
from
gracedb.models
import
Event
,
Search
,
Pipeline
,
Group
class
Command
(
NoArgsCommand
):
help
=
"
I kill the MDC events.
"
def
handle_noargs
(
self
,
**
options
):
"""
Note! This needs to be run as root. The reason is that these
directories are owned by www-data. And the
'
gracedb
'
user
doesn
'
t have sudo.
"""
CBC
=
Group
.
objects
.
get
(
name
=
'
CBC
'
)
gstlal
=
Pipeline
.
objects
.
get
(
name
=
'
gstlal
'
)
MDC
=
Search
.
objects
.
get
(
name
=
'
MDC
'
)
events
=
Event
.
objects
.
filter
(
group
=
CBC
,
pipeline
=
gstlal
,
search
=
MDC
)
for
e
in
events
:
datadir
=
e
.
datadir
()
graceid
=
e
.
graceid
()
print
"
Deleting %s, %s
"
%
(
graceid
,
datadir
)
# First we need to clean up the data directory
# Note. rmtree with throw OSError if the datadir is a softlink.
# Even though there are softlinks farther up the chain, the leafdir
# in question here can be removed by rmtree.
if
os
.
path
.
isdir
(
datadir
):
shutil
.
rmtree
(
datadir
)
# Uhm. For debugging purposes, did we get it?
if
os
.
path
.
isdir
(
datadir
):
print
'
Problem! Have not deleted datadir %s
'
%
datadir
exit
(
1
)
# Now, say goodbye to the database entry
# Does this delete annotations too? That's something to test.
e
.
delete
()
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