Skip to content

Jobs triggered from rules should use their default config #923

@kofalt

Description

@kofalt

Right now, jobs that are launched via a rule end up with an empty config. Before the job is stored in the database, we should ensure it has the proper config - in this case, copying over the default config.

Probably a dependency of #922.

Additional details added by @nagem:

Gear documents stored in mongo will have a config field (possibly empty). An example:

"config" : {
            "multiple" : {
                "exclusiveMaximum" : true,
                "description" : "Any two-digit multiple of ten.",
                "default" : 20,
                "multipleOf" : 10,
                "maximum" : 100,
                "type" : "number"
            },
            "string" : {
                "default" : "Example",
                "type" : "string",
                "description" : "Any string."
            },
            "number" : {
                "default" : 3.5,
                "type" : "number",
                "description" : "Any number."
            },
            "phone" : {
                "default" : "555-5555",
                "pattern" : "^[0-9]{3}-[0-9]{4}$",
                "type" : "string",
                "description" : "Any local phone number, no country or area code."
            },
            "boolean" : {
                "default" : true,
                "type" : "boolean",
                "description" : "Any boolean."
            },
            "integer" : {
                "default" : 7,
                "type" : "integer",
                "description" : "Any integer."
            },
            "string2" : {
                "default" : "Example 2",
                "minLength" : 2,
                "type" : "string",
                "description" : "Any string from 2 to 15 characters long.",
                "maxLength" : 15
            }
        }

Before a job is persisted to the database (in Job.save()), if config is None (or an empty dictionary*), create a config map using the default key listed for each key in the gear's config. If there is no default, do not add the config key.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions