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
90a83b64
Commit
90a83b64
authored
7 years ago
by
Milan Jaros
Browse files
Options
Downloads
Patches
Plain Diff
add worker path for storage and output
parent
31c3b21e
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
flamenco-worker.cfg
+4
-3
4 additions, 3 deletions
flamenco-worker.cfg
flamenco_worker/cli.py
+2
-0
2 additions, 0 deletions
flamenco_worker/cli.py
flamenco_worker/runner.py
+30
-0
30 additions, 0 deletions
flamenco_worker/runner.py
flamenco_worker/worker.py
+3
-0
3 additions, 0 deletions
flamenco_worker/worker.py
with
39 additions
and
3 deletions
flamenco-worker.cfg
+
4
−
3
View file @
90a83b64
[flamenco-worker]
# The URL of the Flamenco Manager. Leave empty for auto-discovery via UPnP/SSDP.
manager_url
=
manager_url
=
http://login2:8083
task_types
=
sleep blender-render file-management
task_update_queue_db
=
flamenco-worker.db
...
...
@@ -10,7 +10,8 @@ may_i_run_interval_seconds = 5
push_log_max_interval_seconds
=
20
push_log_max_entries
=
200
push_act_max_interval_seconds
=
10
worker_storage_dir
=
/scratch/work/user/milanjaros/temp/public/flamenco/output/storage
worker_output_dir
=
/scratch/work/user/milanjaros/temp/public/flamenco/output/output
[loggers]
keys
=
root,flamenco_worker
...
...
@@ -38,7 +39,7 @@ class = logging.handlers.TimedRotatingFileHandler
formatter
=
flamenco
# (filename, when, interval, backupCount, encoding, delay, utc, atTime=None)
# Be aware that tilde expansion is *not* performed on the path.
args
=
('
/tmp/
flamenco-worker.log', 'midnight', 1, 7, 'utf8', True, True)
args
=
('flamenco-worker.log', 'midnight', 1, 7, 'utf8', True, True)
[formatters]
keys
=
flamenco
...
...
This diff is collapsed.
Click to expand it.
flamenco_worker/cli.py
+
2
−
0
View file @
90a83b64
...
...
@@ -87,6 +87,8 @@ def main():
push_log_max_interval
=
confparser
.
interval_secs
(
'
push_log_max_interval_seconds
'
),
push_log_max_entries
=
confparser
.
value
(
'
push_log_max_entries
'
,
int
),
push_act_max_interval
=
confparser
.
interval_secs
(
'
push_act_max_interval_seconds
'
),
worker_storage_dir
=
confparser
.
value
(
'
worker_storage_dir
'
),
worker_output_dir
=
confparser
.
value
(
'
worker_output_dir
'
),
)
mir
=
may_i_run
.
MayIRun
(
...
...
This diff is collapsed.
Click to expand it.
flamenco_worker/runner.py
+
30
−
0
View file @
90a83b64
...
...
@@ -3,6 +3,7 @@
import
asyncio
import
attr
import
os
from
.
import
attrs_extra
from
.
import
worker
...
...
@@ -20,6 +21,32 @@ class TaskRunner:
def
__attrs_post_init__
(
self
):
self
.
current_command
=
None
def
check_storage_dir
(
self
,
settings
:
dict
,
fworker
:
worker
.
FlamencoWorker
):
if
not
fworker
.
worker_storage_dir
:
return
if
not
settings
.
get
(
'
filepath
'
):
return
(
head
,
tail
)
=
os
.
path
.
split
(
os
.
path
.
normpath
(
settings
[
'
filepath
'
]))
(
head
,
tail
)
=
os
.
path
.
split
(
head
)
settings
[
'
filepath
'
]
=
os
.
path
.
normpath
(
settings
[
'
filepath
'
]).
replace
(
head
,
os
.
path
.
normpath
(
fworker
.
worker_storage_dir
))
return
def
check_output_dir
(
self
,
settings
:
dict
,
fworker
:
worker
.
FlamencoWorker
):
if
not
fworker
.
worker_output_dir
:
return
if
not
settings
.
get
(
'
render_output
'
):
return
(
head
,
tail
)
=
os
.
path
.
split
(
os
.
path
.
normpath
(
settings
[
'
render_output
'
]))
(
head
,
tail
)
=
os
.
path
.
split
(
head
)
settings
[
'
render_output
'
]
=
os
.
path
.
normpath
(
settings
[
'
render_output
'
]).
replace
(
head
,
os
.
path
.
normpath
(
fworker
.
worker_output_dir
))
return
async
def
execute
(
self
,
task
:
dict
,
fworker
:
worker
.
FlamencoWorker
)
->
bool
:
"""
Executes a task, returns True iff the entire task was run succesfully.
"""
...
...
@@ -36,6 +63,9 @@ class TaskRunner:
raise
ValueError
(
'
Command %i of task %s has no name
'
%
(
cmd_idx
,
task_id
))
cmd_settings
=
cmd_info
.
get
(
'
settings
'
)
self
.
check_storage_dir
(
cmd_settings
,
fworker
)
self
.
check_output_dir
(
cmd_settings
,
fworker
)
if
cmd_settings
is
None
or
not
isinstance
(
cmd_settings
,
dict
):
raise
ValueError
(
'
Command %i of task %s has malformed settings %r
'
%
(
cmd_idx
,
task_id
,
cmd_settings
))
...
...
This diff is collapsed.
Click to expand it.
flamenco_worker/worker.py
+
3
−
0
View file @
90a83b64
...
...
@@ -37,6 +37,9 @@ class FlamencoWorker:
worker_id
=
attr
.
ib
(
validator
=
attr
.
validators
.
instance_of
(
str
))
worker_secret
=
attr
.
ib
(
validator
=
attr
.
validators
.
instance_of
(
str
))
worker_storage_dir
=
attr
.
ib
(
validator
=
attr
.
validators
.
instance_of
(
str
))
worker_output_dir
=
attr
.
ib
(
validator
=
attr
.
validators
.
instance_of
(
str
))
loop
=
attr
.
ib
(
validator
=
attr
.
validators
.
instance_of
(
asyncio
.
AbstractEventLoop
))
shutdown_future
=
attr
.
ib
(
validator
=
attr
.
validators
.
optional
(
attr
.
validators
.
instance_of
(
asyncio
.
Future
)))
...
...
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