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:
Sybren A. Stüvel 2022-07-05 18:19:49 +02:00
parent d4429d593c
commit ac5bb5e378
2 changed files with 27 additions and 12 deletions

View File

@ -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)

View File

@ -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}".
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"
task.Commands[2].Parameters["filepath"] = "{jobs}/path/in/storage.blend"
replacedTask := replaceTaskVariables(&conf, task, worker)
expectPath := path.Join(conf.Shaman.CheckoutPath(), "path/in/shaman.blend")
assert.Equal(t, expectPath, replacedTask.Commands[2].Parameters["filepath"])
// 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
})
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"])
}
}