Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flamenco-worker-python
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
flamenco-worker-python
Commits
1a83db0b
Commit
1a83db0b
authored
8 years ago
by
Sybren A. Stüvel
Browse files
Options
Downloads
Patches
Plain Diff
Manager: added -cleanslate CLI argument
parent
f0dd69a4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/flamenco-manager-go/src/flamenco-manager/flamenco/db.go
+23
-0
23 additions, 0 deletions
...s/flamenco-manager-go/src/flamenco-manager/flamenco/db.go
packages/flamenco-manager-go/src/flamenco-manager/main.go
+13
-4
13 additions, 4 deletions
packages/flamenco-manager-go/src/flamenco-manager/main.go
with
36 additions
and
4 deletions
packages/flamenco-manager-go/src/flamenco-manager/flamenco/db.go
+
23
−
0
View file @
1a83db0b
package
flamenco
package
flamenco
import
(
import
(
"bufio"
"fmt"
"os"
log
"github.com/Sirupsen/logrus"
log
"github.com/Sirupsen/logrus"
mgo
"gopkg.in/mgo.v2"
mgo
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"gopkg.in/mgo.v2/bson"
...
@@ -98,3 +102,22 @@ func SaveSettings(db *mgo.Database, settings *SettingsInMongo) {
...
@@ -98,3 +102,22 @@ func SaveSettings(db *mgo.Database, settings *SettingsInMongo) {
log
.
Errorf
(
"db.SaveSettings: Unable to save settings: "
,
err
)
log
.
Errorf
(
"db.SaveSettings: Unable to save settings: "
,
err
)
}
}
}
}
/* Erases all tasks in the flamenco_tasks collection. */
func
CleanSlate
(
db
*
mgo
.
Database
)
{
fmt
.
Println
(
""
)
fmt
.
Println
(
"Performing Clean Slate operation, this will erase all tasks from the local DB."
)
fmt
.
Println
(
"After performing the Clean Slate, Flamenco-Manager will shut down."
)
fmt
.
Println
(
"Press [ENTER] to continue, [Ctrl+C] to abort."
)
bufio
.
NewReader
(
os
.
Stdin
)
.
ReadLine
()
info
,
err
:=
db
.
C
(
"flamenco_tasks"
)
.
RemoveAll
(
bson
.
M
{})
if
err
!=
nil
{
log
.
WithError
(
err
)
.
Panic
(
"unable to erase all tasks"
)
}
log
.
Warningf
(
"Erased %d tasks"
,
info
.
Removed
)
settings
:=
GetSettings
(
db
)
settings
.
DepsgraphLastModified
=
nil
SaveSettings
(
db
,
settings
)
}
This diff is collapsed.
Click to expand it.
packages/flamenco-manager-go/src/flamenco-manager/main.go
+
13
−
4
View file @
1a83db0b
...
@@ -47,7 +47,7 @@ func http_schedule_task(w http.ResponseWriter, r *auth.AuthenticatedRequest) {
...
@@ -47,7 +47,7 @@ func http_schedule_task(w http.ResponseWriter, r *auth.AuthenticatedRequest) {
func
http_kick
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
func
http_kick
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
upstream
.
KickDownloader
(
false
)
upstream
.
KickDownloader
(
false
)
w
.
WriteHeader
(
204
)
fmt
.
Fprintln
(
w
,
"Kicked task downloader"
)
}
}
func
http_task_update
(
w
http
.
ResponseWriter
,
r
*
auth
.
AuthenticatedRequest
)
{
func
http_task_update
(
w
http
.
ResponseWriter
,
r
*
auth
.
AuthenticatedRequest
)
{
...
@@ -120,15 +120,17 @@ func shutdown(signum os.Signal) {
...
@@ -120,15 +120,17 @@ func shutdown(signum os.Signal) {
}
}
var
cliArgs
struct
{
var
cliArgs
struct
{
verbose
bool
verbose
bool
debug
bool
debug
bool
jsonLog
bool
jsonLog
bool
cleanSlate
bool
}
}
func
parseCliArgs
()
{
func
parseCliArgs
()
{
flag
.
BoolVar
(
&
cliArgs
.
verbose
,
"verbose"
,
false
,
"Enable info-level logging"
)
flag
.
BoolVar
(
&
cliArgs
.
verbose
,
"verbose"
,
false
,
"Enable info-level logging"
)
flag
.
BoolVar
(
&
cliArgs
.
debug
,
"debug"
,
false
,
"Enable debug-level logging"
)
flag
.
BoolVar
(
&
cliArgs
.
debug
,
"debug"
,
false
,
"Enable debug-level logging"
)
flag
.
BoolVar
(
&
cliArgs
.
jsonLog
,
"json"
,
false
,
"Log in JSON format"
)
flag
.
BoolVar
(
&
cliArgs
.
jsonLog
,
"json"
,
false
,
"Log in JSON format"
)
flag
.
BoolVar
(
&
cliArgs
.
cleanSlate
,
"cleanslate"
,
false
,
"Start with a clean slate; erases all tasks from the local MongoDB"
)
flag
.
Parse
()
flag
.
Parse
()
}
}
...
@@ -178,6 +180,13 @@ func main() {
...
@@ -178,6 +180,13 @@ func main() {
log
.
Info
(
"Listening at :"
,
config
.
Listen
)
log
.
Info
(
"Listening at :"
,
config
.
Listen
)
session
=
flamenco
.
MongoSession
(
&
config
)
session
=
flamenco
.
MongoSession
(
&
config
)
if
cliArgs
.
cleanSlate
{
flamenco
.
CleanSlate
(
session
.
DB
(
""
))
log
.
Warning
(
"Shutting down after performing clean slate"
)
return
}
upstream
=
flamenco
.
ConnectUpstream
(
&
config
,
session
)
upstream
=
flamenco
.
ConnectUpstream
(
&
config
,
session
)
task_scheduler
=
flamenco
.
CreateTaskScheduler
(
&
config
,
upstream
,
session
)
task_scheduler
=
flamenco
.
CreateTaskScheduler
(
&
config
,
upstream
,
session
)
task_update_pusher
=
flamenco
.
CreateTaskUpdatePusher
(
&
config
,
upstream
,
session
)
task_update_pusher
=
flamenco
.
CreateTaskUpdatePusher
(
&
config
,
upstream
,
session
)
...
...
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