Remove assumption {jobs}
only exists when Shaman is enabled
Manager always creates an implicit variable `{jobs}`. This used to be Shaman-dependent, but now it's always there (has been for a while). This is now reflected in an add-on comment, and in an extra unit test.
This commit is contained in:
parent
d4429d593c
commit
ac5bb5e378
@ -321,8 +321,8 @@ class FLAMENCO_OT_submit_job(FlamencoOpMixin, bpy.types.Operator):
|
||||
# may have checked out at a different location than we
|
||||
# requested.
|
||||
#
|
||||
# Having Shaman enabled on the Manager automatically creates a
|
||||
# variable "jobs" that will resolve to the checkout directory.
|
||||
# Manager automatically creates a variable "jobs" that will
|
||||
# resolve to the job storage directory.
|
||||
self.blendfile_on_farm = PurePosixPath("{jobs}") / msg.output_path
|
||||
|
||||
self._submit_job(context)
|
||||
|
@ -100,16 +100,31 @@ func TestReplacePathsUnknownOS(t *testing.T) {
|
||||
func TestReplaceJobsVariable(t *testing.T) {
|
||||
worker := persistence.Worker{Platform: "linux"}
|
||||
|
||||
// Having the Shaman enabled should create an implicit variable "{jobs}".
|
||||
task := varreplTestTask()
|
||||
task.Commands[2].Parameters["filepath"] = "{jobs}/path/in/storage.blend"
|
||||
|
||||
// An implicit variable "{jobs}" should be created, regardless of whether
|
||||
// Shaman is enabled or not.
|
||||
|
||||
{ // Test with Shaman enabled.
|
||||
conf := config.GetTestConfig(func(c *config.Conf) {
|
||||
c.SharedStoragePath = "/path/to/flamenco-storage"
|
||||
c.Shaman.Enabled = true
|
||||
})
|
||||
|
||||
task := varreplTestTask()
|
||||
task.Commands[2].Parameters["filepath"] = "{jobs}/path/in/shaman.blend"
|
||||
|
||||
replacedTask := replaceTaskVariables(&conf, task, worker)
|
||||
expectPath := path.Join(conf.Shaman.CheckoutPath(), "path/in/shaman.blend")
|
||||
expectPath := path.Join(conf.Shaman.CheckoutPath(), "path/in/storage.blend")
|
||||
assert.Equal(t, expectPath, replacedTask.Commands[2].Parameters["filepath"])
|
||||
}
|
||||
|
||||
{ // Test without Shaman.
|
||||
conf := config.GetTestConfig(func(c *config.Conf) {
|
||||
c.SharedStoragePath = "/path/to/flamenco-storage"
|
||||
c.Shaman.Enabled = false
|
||||
})
|
||||
|
||||
replacedTask := replaceTaskVariables(&conf, task, worker)
|
||||
expectPath := "/path/to/flamenco-storage/jobs/path/in/storage.blend"
|
||||
assert.Equal(t, expectPath, replacedTask.Commands[2].Parameters["filepath"])
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user