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

task manifest magic #1179

Open
candysmurf opened this issue Sep 2, 2016 · 6 comments
Open

task manifest magic #1179

candysmurf opened this issue Sep 2, 2016 · 6 comments

Comments

@candysmurf
Copy link
Contributor

candysmurf commented Sep 2, 2016

  • if change the task manifest version to any number other than 1, it gave the following error:

    Using task manifest to create task
    Error: Invalid version provided for task manifest

  • if change the schedule interval to "100ms", the task created, if you run command "snapctl export taskid" it still shown "5s"

  • if change the task type to "windowed", it thrown an exception:

 $SNAP_PATH/bin/snapctl task create -t ~/task/justin-task/task-1.json
Using task manifest to create task
Error creating task:Unknown API response: invalid character 'P' looking for beginning of value

 Received: PANIC: runtime error: invalid memory address or nil pointer dereference
goroutine 103 [running]:
github.com/intelsdi-x/snap/vendor/github.com/codegangsta/negroni.(*Recovery).ServeHTTP.func1(0x882110f428, 0x821267bc0, 0x8211e2c60)
    /Users/egu/.gvm/pkgsets/go1.6.2/snap-2016-06/src/github.com/intelsdi-x/snap/vendor/github.com/codegangsta/negroni/recovery.go:34 +0xe9
panic(0x916760, 0x8210c40f0)
    /Users/egu/.gvm/gos/go1.6.2/src/runtime/panic.go:443 +0x4e9
github.com/intelsdi-x/snap/mgmt/rest/rbody.assertSchedule(0x8821115e50, 0x821272b60, 0x8212a4320)
    /Users/egu/.gvm/pkgsets/go1.6.2/snap-2016-06/src/github.com/intelsdi-x/snap/mgmt/rest/rbody/task.go:225 +0x4af
github.com/intelsdi-x/snap/mgmt/rest/rbody.AddSchedulerTaskFromTask(0x8821117078, 0x8212c0a00, 0x821349950)
    /Users/egu/.gvm/pkgsets/go1.6.2/snap-2016-06/src/github.com/intelsdi-x/snap/mgmt/rest/rbody/task.go:111 +0x43d
github.com/intelsdi-x/snap/mgmt/rest.(*Server).addTask(0x821179450, 0x882110f428, 0x821267bc0, 0x8210cf340, 0x0, 0
  • When specifying any value other than "simple" and "windowed", it gave

Using task manifest to create task
Usage error; cannot replace existing schedule of type 'abc123' with a new, 'simple' schedule

I'm not sure what the error suggests.

  • When no type specified for the schedule, it takes the default "simple" schedule type and task ran. It's better than putting in a wrong schedule type.
@geauxvirtual
Copy link
Contributor

Task manifest version can only be 1 via snapctl since that is the only place where it checks. There is another issue open about this.

Windowed schedules are not supported in task manifests. There is another issue opened about this as well.

Justin Guidroz
Sent from my iPhone

On Sep 2, 2016, at 3:15 PM, Emily Gu notifications@github.com wrote:

if change the task manifest version to any number other than 1, it gave the following error:

Using task manifest to create task
Error: Invalid version provided for task manifest

if change the schedule interval to "100ms", the task created, if you run command "snapctl export taskid" it still show "5s"

if change the task type to "windowed", it thrown an exception:

$SNAP_PATH/bin/snapctl task create -t ~/task/justin-task/task-1.json
Using task manifest to create task
Error creating task:Unknown API response: invalid character 'P' looking for beginning of value

Received: PANIC: runtime error: invalid memory address or nil pointer dereference
goroutine 103 [running]:
github.com/intelsdi-x/snap/vendor/github.com/codegangsta/negroni.(_Recovery).ServeHTTP.func1(0x882110f428, 0x821267bc0, 0x8211e2c60)
/Users/egu/.gvm/pkgsets/go1.6.2/snap-2016-06/src/github.com/intelsdi-x/snap/vendor/github.com/codegangsta/negroni/recovery.go:34 +0xe9
panic(0x916760, 0x8210c40f0)
/Users/egu/.gvm/gos/go1.6.2/src/runtime/panic.go:443 +0x4e9
github.com/intelsdi-x/snap/mgmt/rest/rbody.assertSchedule(0x8821115e50, 0x821272b60, 0x8212a4320)
/Users/egu/.gvm/pkgsets/go1.6.2/snap-2016-06/src/github.com/intelsdi-x/snap/mgmt/rest/rbody/task.go:225 +0x4af
github.com/intelsdi-x/snap/mgmt/rest/rbody.AddSchedulerTaskFromTask(0x8821117078, 0x8212c0a00, 0x821349950)
/Users/egu/.gvm/pkgsets/go1.6.2/snap-2016-06/src/github.com/intelsdi-x/snap/mgmt/rest/rbody/task.go:111 +0x43d
github.com/intelsdi-x/snap/mgmt/rest.(_Server).addTask(0x821179450, 0x882110f428, 0x821267bc0, 0x8210cf340, 0x0, 0

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@candysmurf
Copy link
Contributor Author

@geauxvirtual, thanks Justin for clarifying it. Probably we can give a better error message if "windowed" schedule is not supported.

@geauxvirtual
Copy link
Contributor

No, the fix is to add proper support for windowed schedule in the task manifestand only return an error on an incorrect schedule.

Justin Guidroz
Sent from my iPhone

On Sep 2, 2016, at 5:01 PM, Emily Gu notifications@github.com wrote:

@geauxvirtual, thanks Justin for clarifying it. Probably we can give a better error message if "windowed" schedule is not supported.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@IRCody
Copy link
Contributor

IRCody commented Sep 6, 2016

Task manifest version can only be 1 via snapctl since that is the only place where it checks. There is another issue open about this.

Just to link it, that issue is #1162.

@geauxvirtual
Copy link
Contributor

geauxvirtual commented Sep 6, 2016

if change the schedule interval to "100ms", the task created, if you run command "snapctl export taskid" it still shown "5s"

I am unable to reproduce this issue. Task interval is still set to 100ms in the export of the created task.

Task file

{
    "version": 1,
    "schedule": {
        "type": "simple",
        "interval": "100ms"
    },
    "max-failures": 10,
    "workflow": {
        "collect": {
            "metrics": {
                "/intel/mock/foo": {},
                "/intel/mock/bar": {},
                "/intel/mock/*/baz": {}
            },
            "config": {
                "/intel/mock": {
                    "name": "root",
                    "password": "secret"
                }
            },
            "process": [
                {
                    "plugin_name": "passthru",
                    "process": null,
                    "publish": [
                        {
                            "plugin_name": "mock-file",
                            "config": {
                                "file": "/tmp/snap_published_mock_file.log"
                            }
                        }
                    ]
                }
            ]
        }
    }
}

Task export

    "id": "fab9269b-3a21-47ae-bb4a-fa76d641edb3",
    "name": "Task-fab9269b-3a21-47ae-bb4a-fa76d641edb3",
    "deadline": "5s",
    "workflow": {
        "collect": {
            "metrics": {
                "/intel/mock/*/baz": {
                    "version": 0
                },
                "/intel/mock/bar": {
                    "version": 0
                },
                "/intel/mock/foo": {
                    "version": 0
                }
            },
            "config": {
                "/intel/mock": {
                    "name": "root",
                    "password": "secret"
                }
            },
            "process": [
                {
                    "plugin_name": "passthru",
                    "plugin_version": 0,
                    "publish": [
                        {
                            "plugin_name": "mock-file",
                            "plugin_version": 0,
                            "config": {
                                "file": "/tmp/snap_published_mock_file.log"
                            },
                            "target": ""
                        }
                    ],
                    "target": ""
                }
            ]
        }
    },
    "schedule": {
        "type": "simple",
        "interval": "100ms"
    },
    "creation_timestamp": 1473206175,
    "last_run_timestamp": 1473206192,
    "hit_count": 153,
    "task_state": "Running",
    "href": "http://localhost:8181/v1/tasks/fab9269b-3a21-47ae-bb4a-fa76d641edb3",
    "Err": null
}

@snapbot snapbot added the tracked label Sep 7, 2016
@candysmurf
Copy link
Contributor Author

candysmurf commented Sep 8, 2016

@geauxvirtual, thanks for checking. Yes, the interval issue is unable to reproduce with the latest Snap.
The "windowed" schedule is the duplicate of issue #1134. @IRCody linked #1162.

What about other two issues I reported. Are they legit?

  • When specifying any value other than "simple" and "windowed", it gave the following. A clear error message for what Snap supports would be a better message.

Using task manifest to create task
Usage error; cannot replace existing schedule of type 'abc123' with a new, 'simple' schedule

  • When no type specified for the schedule, it takes the default "simple" schedule type and task ran. Is it by design?
"schedule": {
        "interval": "10ms"
 }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants