intelsdi-x / snap

The open telemetry framework
http://snap-telemetry.io
Apache License 2.0
1.8k stars 294 forks source link

task manifest magic #1179

Open candysmurf opened 8 years ago

candysmurf commented 8 years ago
 $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

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.

geauxvirtual commented 8 years ago

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 commented 8 years ago

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

geauxvirtual commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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
}
candysmurf commented 8 years ago

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

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"
 }