Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Tasks don't reflect changes to plugin config #1222

Closed
jcooklin opened this issue Sep 20, 2016 · 1 comment · Fixed by #1225
Closed

Tasks don't reflect changes to plugin config #1222

jcooklin opened this issue Sep 20, 2016 · 1 comment · Fixed by #1225

Comments

@jcooklin
Copy link
Collaborator

jcooklin commented Sep 20, 2016

To reproduce add a plugin configuration item that will be used by a given task, start the given task and then update the configuration item.

Expected result: When a task, depending on a configuration item that is not provided by the task, is changed the task should start using this new configuration item.
Actual result: The new configuration is ignored.

In the example below:

  1. snapd is started with the following config.
  2. Plugins snap-plugin-collector-mock1 and snap-plugin-publisher-mock-file are loaded.
  3. The task is left to run for 5 seconds.
  4. The plugin-config for mock-file is updated
  • curl -X PUT --data '{"file": "/tmp/snap/snap-file2.out"}' http://localhost:8181/v1/plugins/publisher/mock-file/3/config
---
control:
  plugins:
    publisher:
      mock-file:
        all:
          file: /tmp/snap/snap-file.out
          test: true

ex

@geauxvirtual
Copy link
Contributor

What's happening here is when a new task is created, the workflow ends up being a pointer to the workflow created from the wfmap here, https://github.com/intelsdi-x/snap/blob/master/scheduler/scheduler.go#L315-L330.

Further in createTask, the code tries to validate the dependencies for the plugins, https://github.com/intelsdi-x/snap/blob/master/scheduler/scheduler.go#L342.

When this occurs, any global plugin config defined gets merged into the workflow here, https://github.com/intelsdi-x/snap/blob/master/control/subscription_group.go#L238-L240.

Since task.workflow is the same pointer to wf, task.workflow now has configuration items defined for the plugin that came from the plugin global config and not the task manifest.

When PublishMetrics is called, any global plugin config is pulled in, and then any task level config for the plugin is merged in with the global plugin config, with the task level config taking precedence. https://github.com/intelsdi-x/snap/blob/master/control/control.go#L986-L993.

jcooklin added a commit to jcooklin/snap that referenced this issue Sep 21, 2016
jcooklin added a commit to jcooklin/snap that referenced this issue Sep 23, 2016
* Adds ApplyDefaults(map[string]ctypes.ConfigValue) to ConfigDataNode
* Renames ReverseMerge to ReverseMergeInPlace on ConfigDataNode
* Adds ReverseMerge to ConfigDataNode returning a copy of the merged
node

ReverseMerge, which now returns a copy, is called when validating deps (task
creation) and when loading plugins.
jcooklin added a commit to jcooklin/snap that referenced this issue Oct 5, 2016
* Adds ApplyDefaults(map[string]ctypes.ConfigValue) to ConfigDataNode
* Renames ReverseMerge to ReverseMergeInPlace on ConfigDataNode
* Adds ReverseMerge to ConfigDataNode returning a copy of the merged
node

ReverseMerge, which now returns a copy, is called when validating deps (task
creation) and when loading plugins.
jcooklin added a commit that referenced this issue Oct 7, 2016
Fixes #1222 and #1228 : Applies config defaults - Metric too ambiguous
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants