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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
flamenco-worker-python
Commits
cecbe7cf
Commit
cecbe7cf
authored
Jan 3, 2017
by
Sybren A. Stüvel
Browse files
Options
Downloads
Patches
Plain Diff
Worker: master → manager
parent
bb6506a6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/flamenco-worker-python/flamenco_worker/worker.py
+13
-13
13 additions, 13 deletions
packages/flamenco-worker-python/flamenco_worker/worker.py
with
13 additions
and
13 deletions
packages/flamenco-worker-python/flamenco_worker/worker.py
+
13
−
13
View file @
cecbe7cf
...
@@ -48,7 +48,7 @@ class FlamencoWorker:
...
@@ -48,7 +48,7 @@ class FlamencoWorker:
default
=
datetime
.
datetime
.
now
(),
default
=
datetime
.
datetime
.
now
(),
validator
=
attr
.
validators
.
optional
(
attr
.
validators
.
instance_of
(
datetime
.
datetime
)))
validator
=
attr
.
validators
.
optional
(
attr
.
validators
.
instance_of
(
datetime
.
datetime
)))
# Kept in sync with the task updates we send to upstream Ma
st
er, so that we can send
# Kept in sync with the task updates we send to upstream Ma
nag
er, so that we can send
# a complete Activity each time.
# a complete Activity each time.
last_task_activity
=
attr
.
ib
(
default
=
attr
.
Factory
(
documents
.
Activity
))
last_task_activity
=
attr
.
ib
(
default
=
attr
.
Factory
(
documents
.
Activity
))
...
@@ -178,7 +178,7 @@ class FlamencoWorker:
...
@@ -178,7 +178,7 @@ class FlamencoWorker:
# when we're in some infinite failure loop.
# when we're in some infinite failure loop.
self
.
schedule_fetch_task
(
3
)
self
.
schedule_fetch_task
(
3
)
def
push_to_ma
st
er
(
self
):
def
push_to_ma
nag
er
(
self
):
"""
Updates a task
'
s status and activity.
"""
Updates a task
'
s status and activity.
"""
"""
...
@@ -212,10 +212,10 @@ class FlamencoWorker:
...
@@ -212,10 +212,10 @@ class FlamencoWorker:
def
register_task_update
(
self
,
*
,
def
register_task_update
(
self
,
*
,
task_status
:
str
=
None
,
task_status
:
str
=
None
,
**
kwargs
):
**
kwargs
):
"""
Stores the task status and activity, and possibly sends to Flamenco Ma
st
er.
"""
Stores the task status and activity, and possibly sends to Flamenco Ma
nag
er.
If the last update to Ma
st
er was long enough ago, or the task status changed,
If the last update to Ma
nag
er was long enough ago, or the task status changed,
the info is sent to Ma
st
er. This way we can update command progress percentage
the info is sent to Ma
nag
er. This way we can update command progress percentage
hundreds of times per second, without worrying about network overhead.
hundreds of times per second, without worrying about network overhead.
"""
"""
...
@@ -230,12 +230,12 @@ class FlamencoWorker:
...
@@ -230,12 +230,12 @@ class FlamencoWorker:
self
.
current_task_status
=
task_status
self
.
current_task_status
=
task_status
if
task_status_changed
:
if
task_status_changed
:
self
.
_log
.
info
(
'
Task changed status to %s, pushing to ma
st
er
'
,
task_status
)
self
.
_log
.
info
(
'
Task changed status to %s, pushing to ma
nag
er
'
,
task_status
)
self
.
push_to_ma
st
er
()
self
.
push_to_ma
nag
er
()
elif
datetime
.
datetime
.
now
()
-
self
.
last_activity_push
>
PUSH_ACT_MAX_INTERVAL
:
elif
datetime
.
datetime
.
now
()
-
self
.
last_activity_push
>
PUSH_ACT_MAX_INTERVAL
:
self
.
_log
.
info
(
'
More than %s since last activity update, pushing to ma
st
er
'
,
self
.
_log
.
info
(
'
More than %s since last activity update, pushing to ma
nag
er
'
,
PUSH_ACT_MAX_INTERVAL
)
PUSH_ACT_MAX_INTERVAL
)
self
.
push_to_ma
st
er
()
self
.
push_to_ma
nag
er
()
def
register_log
(
self
,
log_entry
):
def
register_log
(
self
,
log_entry
):
"""
Registers a log entry, and possibly sends all queued log entries to upstream Master.
"""
"""
Registers a log entry, and possibly sends all queued log entries to upstream Master.
"""
...
@@ -246,13 +246,13 @@ class FlamencoWorker:
...
@@ -246,13 +246,13 @@ class FlamencoWorker:
self
.
queued_log_entries
.
append
(
'
%s: %s
'
%
(
now
,
log_entry
))
self
.
queued_log_entries
.
append
(
'
%s: %s
'
%
(
now
,
log_entry
))
if
len
(
self
.
queued_log_entries
)
>
PUSH_LOG_MAX_ENTRIES
:
if
len
(
self
.
queued_log_entries
)
>
PUSH_LOG_MAX_ENTRIES
:
self
.
_log
.
info
(
'
Queued up more than %i log entries, pushing to ma
st
er
'
,
self
.
_log
.
info
(
'
Queued up more than %i log entries, pushing to ma
nag
er
'
,
PUSH_LOG_MAX_ENTRIES
)
PUSH_LOG_MAX_ENTRIES
)
self
.
push_to_ma
st
er
()
self
.
push_to_ma
nag
er
()
elif
datetime
.
datetime
.
now
()
-
self
.
last_log_push
>
PUSH_LOG_MAX_INTERVAL
:
elif
datetime
.
datetime
.
now
()
-
self
.
last_log_push
>
PUSH_LOG_MAX_INTERVAL
:
self
.
_log
.
info
(
'
More than %s since last log update, pushing to ma
st
er
'
,
self
.
_log
.
info
(
'
More than %s since last log update, pushing to ma
nag
er
'
,
PUSH_LOG_MAX_INTERVAL
)
PUSH_LOG_MAX_INTERVAL
)
self
.
push_to_ma
st
er
()
self
.
push_to_ma
nag
er
()
def
generate_secret
()
->
str
:
def
generate_secret
()
->
str
:
...
...
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