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

Fixes 1043: Modifies snap to allow for removal of disabled tasks #1069

Merged
merged 1 commit into from
Jul 14, 2016

Conversation

tjmcs
Copy link
Contributor

@tjmcs tjmcs commented Jul 14, 2016

Fixes #1043

Summary of changes:

  • Modified conditional statement in scheduler/task.go to allow for removal of both stopped and disabled tasks

Testing done:

  • started snapd and checked to make sure the mock plugins autoloaded
  • created a task that utilized the mock plugins
  • unloaded the mock collector plugins
  • checked to make sure that the task entered a disabled state
  • removed the disabled task

here's the output of the terminal session from the point where I created the task through to the point where the task was removed:

$ snapctl -u "https://127.0.0.1:12345" --insecure task create -t examples/tasks/mock-file.json
Using task manifest to create task
Task created
ID: a61d2366-402d-475c-b169-49fc1d6cd13e
Name: Task-a61d2366-402d-475c-b169-49fc1d6cd13e
State: Running

$ snapctl -u "https://127.0.0.1:12345" --insecure plugin unload collector:mock:1
Plugin unloaded
Name: mock
Version: 1
Type: collector

$ snapctl -u "https://127.0.0.1:12345" --insecure plugin unload collector:mock:2
Plugin unloaded
Name: mock
Version: 2
Type: collector

$ snapctl -u "https://127.0.0.1:12345" --insecure task list
ID                   NAME                        STATE       HIT     MISS    FAIL    CREATED         LAST FAILURE
a61d2366-402d-475c-b169-49fc1d6cd13e     Task-a61d2366-402d-475c-b169-49fc1d6cd13e   Running     19      0   9   11:57AM 7-14-2016   Metric not found: /intel/mock/*/baz

$ snapctl -u "https://127.0.0.1:12345" --insecure task list
ID                   NAME                        STATE       HIT     MISS    FAIL    CREATED         LAST FAILURE
a61d2366-402d-475c-b169-49fc1d6cd13e     Task-a61d2366-402d-475c-b169-49fc1d6cd13e   Disabled    20      0   10      11:57AM 7-14-2016   Metric not found: /intel/mock/*/baz

$ snapctl -u "https://127.0.0.1:12345" --insecure task remove a61d2366-402d-475c-b169-49fc1d6cd13e
Task removed:
ID: a61d2366-402d-475c-b169-49fc1d6cd13e

$ snapctl -u "https://127.0.0.1:12345" --insecure task list
ID   NAME    STATE   HIT     MISS    FAIL    CREATED     LAST FAILURE

$

@intelsdi-x/snap-maintainers

@IRCody
Copy link
Contributor

IRCody commented Jul 14, 2016

LGTM

@jcooklin jcooklin merged commit 8dd792b into intelsdi-x:master Jul 14, 2016
@tjmcs tjmcs deleted the tb/stop-disabled-task branch July 14, 2016 23:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants