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
|
# may have checked out at a different location than we
|
||||||
# requested.
|
# requested.
|
||||||
#
|
#
|
||||||
# Having Shaman enabled on the Manager automatically creates a
|
# Manager automatically creates a variable "jobs" that will
|
||||||
# variable "jobs" that will resolve to the checkout directory.
|
# resolve to the job storage directory.
|
||||||
self.blendfile_on_farm = PurePosixPath("{jobs}") / msg.output_path
|
self.blendfile_on_farm = PurePosixPath("{jobs}") / msg.output_path
|
||||||
|
|
||||||
self._submit_job(context)
|
self._submit_job(context)
|
||||||
|
@ -100,16 +100,31 @@ func TestReplacePathsUnknownOS(t *testing.T) {
|
|||||||
func TestReplaceJobsVariable(t *testing.T) {
|
func TestReplaceJobsVariable(t *testing.T) {
|
||||||
worker := persistence.Worker{Platform: "linux"}
|
worker := persistence.Worker{Platform: "linux"}
|
||||||
|
|
||||||
// Having the Shaman enabled should create an implicit variable "{jobs}".
|
|
||||||
conf := config.GetTestConfig(func(c *config.Conf) {
|
|
||||||
c.SharedStoragePath = "/path/to/flamenco-storage"
|
|
||||||
c.Shaman.Enabled = true
|
|
||||||
})
|
|
||||||
|
|
||||||
task := varreplTestTask()
|
task := varreplTestTask()
|
||||||
task.Commands[2].Parameters["filepath"] = "{jobs}/path/in/shaman.blend"
|
task.Commands[2].Parameters["filepath"] = "{jobs}/path/in/storage.blend"
|
||||||
|
|
||||||
replacedTask := replaceTaskVariables(&conf, task, worker)
|
// An implicit variable "{jobs}" should be created, regardless of whether
|
||||||
expectPath := path.Join(conf.Shaman.CheckoutPath(), "path/in/shaman.blend")
|
// Shaman is enabled or not.
|
||||||
assert.Equal(t, expectPath, replacedTask.Commands[2].Parameters["filepath"])
|
|
||||||
|
{ // Test with Shaman enabled.
|
||||||
|
conf := config.GetTestConfig(func(c *config.Conf) {
|
||||||
|
c.SharedStoragePath = "/path/to/flamenco-storage"
|
||||||
|
c.Shaman.Enabled = true
|
||||||
|
})
|
||||||
|
|
||||||
|
replacedTask := replaceTaskVariables(&conf, task, worker)
|
||||||
|
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