add admin script worker (#8491)
* admin: add plugin lock coordination * shell: allow bypassing lock checks * plugin worker: add admin script handler * mini: include admin_script in plugin defaults * admin script UI: drop name and enlarge text * admin script: add default script * admin_script: make run interval configurable * plugin: gate other jobs during admin_script runs * plugin: use last completed admin_script run * admin: backfill plugin config defaults * templ Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * comparable to default version Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * default to run Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * format Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * shell: respect pre-set noLock for fix.replication * shell: add force no-lock mode for admin scripts * volume balance worker already exists Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * admin: expose scheduler status JSON * shell: add sleep command * shell: restrict sleep syntax * Revert "shell: respect pre-set noLock for fix.replication" This reverts commit 2b14e8b82602a740d3a473c085e3b3a14f1ddbb3. * templ Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * fix import Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * less logs Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * Reduce master client logs on canceled contexts * Update mini default job type count --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -38,6 +38,7 @@ type CommandEnv struct {
|
||||
option *ShellOptions
|
||||
locker *exclusive_locks.ExclusiveLocker
|
||||
noLock bool
|
||||
forceNoLock bool
|
||||
verbose bool
|
||||
}
|
||||
|
||||
@@ -71,6 +72,9 @@ func (ce *CommandEnv) isDirectory(path string) bool {
|
||||
|
||||
func (ce *CommandEnv) confirmIsLocked(args []string) error {
|
||||
|
||||
if ce.noLock || ce.forceNoLock {
|
||||
return nil
|
||||
}
|
||||
if ce.locker.IsLocked() {
|
||||
return nil
|
||||
}
|
||||
@@ -80,11 +84,25 @@ func (ce *CommandEnv) confirmIsLocked(args []string) error {
|
||||
|
||||
}
|
||||
|
||||
func (ce *CommandEnv) SetNoLock(noLock bool) {
|
||||
if ce == nil {
|
||||
return
|
||||
}
|
||||
ce.noLock = noLock
|
||||
}
|
||||
|
||||
func (ce *CommandEnv) ForceNoLock() {
|
||||
if ce == nil {
|
||||
return
|
||||
}
|
||||
ce.forceNoLock = true
|
||||
}
|
||||
|
||||
func (ce *CommandEnv) isLocked() bool {
|
||||
if ce == nil {
|
||||
return true
|
||||
}
|
||||
if ce.noLock {
|
||||
if ce.noLock || ce.forceNoLock {
|
||||
return true
|
||||
}
|
||||
return ce.locker.IsLocked()
|
||||
|
||||
Reference in New Issue
Block a user