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
12ff49f1
Commit
12ff49f1
authored
6 years ago
by
Sybren A. Stüvel
Browse files
Options
Downloads
Patches
Plain Diff
Throttle 'output produced' messages to Manager
parent
93db5a81
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flamenco_worker/worker.py
+12
-0
12 additions, 0 deletions
flamenco_worker/worker.py
with
12 additions
and
0 deletions
flamenco_worker/worker.py
+
12
−
0
View file @
12ff49f1
...
@@ -5,6 +5,7 @@ import functools
...
@@ -5,6 +5,7 @@ import functools
import
itertools
import
itertools
import
pathlib
import
pathlib
import
tempfile
import
tempfile
import
time
import
traceback
import
traceback
import
typing
import
typing
...
@@ -149,6 +150,8 @@ class FlamencoWorker:
...
@@ -149,6 +150,8 @@ class FlamencoWorker:
_log
=
attrs_extra
.
log
(
'
%s.FlamencoWorker
'
%
__name__
)
_log
=
attrs_extra
.
log
(
'
%s.FlamencoWorker
'
%
__name__
)
_last_output_produced
=
0.0
# seconds since epoch
@property
@property
def
active_task_id
(
self
)
->
typing
.
Optional
[
str
]:
def
active_task_id
(
self
)
->
typing
.
Optional
[
str
]:
"""
Returns the task ID, but only if it is currently executing; returns None otherwise.
"""
"""
Returns the task ID, but only if it is currently executing; returns None otherwise.
"""
...
@@ -663,8 +666,17 @@ class FlamencoWorker:
...
@@ -663,8 +666,17 @@ class FlamencoWorker:
This performs a HTTP POST in a background task, returning as soon as
This performs a HTTP POST in a background task, returning as soon as
the task is scheduled.
the task is scheduled.
Only sends an update every X seconds, to avoid sending too many
requests when we output frames rapidly.
"""
"""
now
=
time
.
time
()
if
now
-
self
.
_last_output_produced
<
30
:
self
.
_log
.
debug
(
'
Throttling POST to Manager /output-produced endpoint
'
)
return
self
.
_last_output_produced
=
now
async
def
do_post
():
async
def
do_post
():
try
:
try
:
self
.
_log
.
info
(
'
Sending %i path(s) to Manager
'
,
len
(
paths
))
self
.
_log
.
info
(
'
Sending %i path(s) to Manager
'
,
len
(
paths
))
...
...
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