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
29c46fea
Commit
29c46fea
authored
6 years ago
by
Sybren A. Stüvel
Browse files
Options
Downloads
Patches
Plain Diff
Log fetch_task stuff in a separate logger
parent
b4c38f0e
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
+8
-7
8 additions, 7 deletions
flamenco_worker/worker.py
with
8 additions
and
7 deletions
flamenco_worker/worker.py
+
8
−
7
View file @
29c46fea
...
...
@@ -404,38 +404,39 @@ class FlamencoWorker:
async
def
fetch_task
(
self
)
->
typing
.
Optional
[
dict
]:
# TODO: use exponential backoff instead of retrying every fixed N seconds.
self
.
_log
.
debug
(
'
Fetching task
'
)
log
=
self
.
_log
.
getChild
(
'
fetch_task
'
)
log
.
debug
(
'
Fetching task
'
)
try
:
resp
=
await
self
.
manager
.
post
(
'
/task
'
,
loop
=
self
.
loop
)
except
requests
.
exceptions
.
RequestException
as
ex
:
self
.
_
log
.
warning
(
'
Error fetching new task, will retry in %i seconds: %s
'
,
log
.
warning
(
'
Error fetching new task, will retry in %i seconds: %s
'
,
FETCH_TASK_FAILED_RETRY_DELAY
,
ex
)
self
.
schedule_fetch_task
(
FETCH_TASK_FAILED_RETRY_DELAY
)
return
None
if
resp
.
status_code
==
204
:
self
.
_
log
.
debug
(
'
No tasks available, will retry in %i seconds.
'
,
log
.
debug
(
'
No tasks available, will retry in %i seconds.
'
,
FETCH_TASK_EMPTY_RETRY_DELAY
)
self
.
schedule_fetch_task
(
FETCH_TASK_EMPTY_RETRY_DELAY
)
return
None
if
resp
.
status_code
==
423
:
status_change
=
documents
.
StatusChangeRequest
(
**
resp
.
json
())
self
.
_
log
.
info
(
'
status change to %r requested when fetching new task
'
,
log
.
info
(
'
status change to %r requested when fetching new task
'
,
status_change
.
status_requested
)
self
.
change_status
(
status_change
.
status_requested
)
return
None
if
resp
.
status_code
!=
200
:
self
.
_
log
.
warning
(
'
Error %i fetching new task, will retry in %i seconds.
'
,
log
.
warning
(
'
Error %i fetching new task, will retry in %i seconds.
'
,
resp
.
status_code
,
FETCH_TASK_FAILED_RETRY_DELAY
)
self
.
schedule_fetch_task
(
FETCH_TASK_FAILED_RETRY_DELAY
)
return
None
task_info
=
resp
.
json
()
self
.
task_id
=
task_info
[
'
_id
'
]
self
.
_
log
.
info
(
'
Received task: %s
'
,
self
.
task_id
)
self
.
_
log
.
debug
(
'
Received task: %s
'
,
task_info
)
log
.
info
(
'
Received task: %s
'
,
self
.
task_id
)
log
.
debug
(
'
Received task: %s
'
,
task_info
)
return
task_info
async
def
execute_task
(
self
,
task_info
:
dict
)
->
None
:
...
...
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