apache / openwhisk-package-alarms Goto Github PK
View Code? Open in Web Editor NEWApache OpenWhisk package that can be used to create periodic, time-based alarms.
Home Page: https://openwhisk.apache.org/
License: Apache License 2.0
Apache OpenWhisk package that can be used to create periodic, time-based alarms.
Home Page: https://openwhisk.apache.org/
License: Apache License 2.0
@paulcastro commented on Mon Nov 21 2016
There may exist use cases where scheduling an alarm to fire periodically and randomly in a range of time is useful. For example, we may want to trigger lengthy backups of several images each day, but have these backups happen at different times. In a operational environment it may be difficult to keep track of "different times." Rather than hard-code a time, it would be useful to specify fire the alarm "at a random time each day/month etc.".
Jenkins allows a job to be scheduled by a hash of the job's name (which isn't random but handles the above use case). Explanation below:
The H symbol can be used with a range. For example, H H(0-7) * * * means some time between 12:00 AM (midnight) to 7:59 AM. You can also use step intervals with H, with or without ranges.
The H symbol can be thought of as a random value over a range, but it actually is a hash of the job name, not a random function, so that the value remains stable for any given project.```
https://github.com/apache/incubator-openwhisk-package-alarms/blob/master/action/alarm.js#L4 should either be sanitized or removed completely as it logs the auth key to the activation unnecessarily; if someone is doing a demo they will inadvertently leak their key as well.
Whilw running the following command for building
./gradlew :distDocker
getting below error
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at docker_eaj445q4b51jflwc79mnh75jr.run(/home/nokia/openwhisk/pkg-alarm-mk/incubator-openwhisk-package-alarms/gradle/docker.gradle:43)
FAILURE: Build failed with an exception.
Where:
Build file '/home/nokia/openwhisk/pkg-alarm-mk/incubator-openwhisk-package-alarms/tests/build.gradle' line: 28
What went wrong:
A problem occurred evaluating project ':tests'.
Could not get unknown property 'sourceSets' for project ':whisktests' of type org.gradle.api.Project.
This issue is an Epic to capture some enhancements for the alarms package
Example configuration
wsk trigger create periodic \
--feed /whisk.system/alarms/alarm \
--param cron "*/2 * * * *" \
--param startDate “2017-10-27T14:00”
--param stopDate “2017-10-27T14:00”
The trigger will start to fire after startDate, and no longer fire after stopDate
The time is UTC, or user can provide time zone
Adding this feature will allow us to deprecate and remove the parameter 'maxTriggers`
(today the default is infinite)
User wants to fire a trigger only once at the specified time/date
Example configuration
wsk trigger create doOnce \
--feed /whisk.system/alarms/once \
--param date "2017-10-27T14:00"
Today the cron syntax doesn't allow to specify intervals, only at the hour mark, and then repeat on the next hour. User have requests that they want more control over the internal of the fires for example every 16, or 12 minutes.
Example configuration
wsk trigger create interval \
--feed /whisk.system/alarms/interval \
--param minutes ”16" \
--param startDate “2017-10-27T14:02”
--param stopDate “2017-10-28T14:00”
Provide in CLI and Feed Abstraction for runOnce Action
Example configuration
wsk invoke myaction --once --date “2017-10-28T14:00”
Under the hood create feed alarm Fire Once, and instead of fire trigger, we invoke the action myAction.
But we also need a way to list and identified actions to be fire in the future, maybe we create a trigger and a rule with a naming convention to allow for this management.
I get an openssl error when trying to create an alarms trigger. I installed the alarms package as follows (this is on a new vagrant openwhisk install):
$ ./installCatalog.sh $AUTH_KEY 172.17.0.1 $COUCHDB_HOST:$COUCHDB_PORT test $API_HOST
...
ok: updated action alarmsWeb/alarmWebAction
$ wsk package list /whisk.system
packages
/whisk.system/alarms shared
/whisk.system/watson-speechToText shared
...
$ wsk action get --summary /whisk.system/alarms/alarm
action /whisk.system/alarms/alarm: Fire trigger when alarm occurs
$ wsk trigger create everyEightSeconds --feed /whisk.system/alarms/alarm -p cron "*/8 * * * * *" -p trigger_payload "{\"name\":\"Mork\", \"place\":\"Ork\"}"
ok: invoked /whisk.system/alarms/alarm with id 184b0aa219564013b4885b659f883908
{
"activationId": "184b0aa219564013b4885b659f883908",
"annotations": [
{
"key": "limits",
"value": {
"logs": 10,
"memory": 256,
"timeout": 60000
}
},
{
"key": "path",
"value": "whisk.system/alarms/alarm"
}
],
"duration": 268,
"end": 1499885736936,
"logs": [],
"name": "alarm",
"namespace": "guest",
"publish": false,
"response": {
"result": {
"error": {
"code": "EPROTO",
"errno": "EPROTO",
"syscall": "write"
}
},
"status": "application error",
"success": false
},
"start": 1499885736668,
"subject": "guest",
"version": "0.0.3"
}
ok: invoked /whisk.system/alarms/alarm with id 257f96bef7a94236a1c3eae1496b21bd
{
"activationId": "257f96bef7a94236a1c3eae1496b21bd",
"annotations": [
{
"key": "limits",
"value": {
"logs": 10,
"memory": 256,
"timeout": 60000
}
},
{
"key": "path",
"value": "whisk.system/alarms/alarm"
}
],
"duration": 179,
"end": 1499885737144,
"logs": [],
"name": "alarm",
"namespace": "guest",
"publish": false,
"response": {
"result": {
"error": {
"code": "EPROTO",
"errno": "EPROTO",
"syscall": "write"
}
},
"status": "application error",
"success": false
},
"start": 1499885736965,
"subject": "guest",
"version": "0.0.3"
}
ok: deleted trigger everyEightSeconds
$ wsk activation logs 257f96bef7a94236a1c3eae1496b21bd
2017-07-12T18:55:37.142606606Z stdout: alarm: Error invoking whisk action: { Error: write EPROTO 139767976155008:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:794:
2017-07-12T18:55:37.142654856Z stdout:
2017-07-12T18:55:37.142659802Z stdout: at exports._errnoException (util.js:1026:11)
2017-07-12T18:55:37.142664127Z stdout: at WriteWrap.afterWrite (net.js:799:14) code: 'EPROTO', errno: 'EPROTO', syscall: 'write' }
Not sure if this has to do with my openwhisk install or this package.
I'm trying to create a cron trigger using this command:
wsk trigger create mytrigger --feed /whisk.system/alarms/alarm --param cron '0 * * * *'
However I get what seems to be a DNS related error:
{
"activationId": "1d2cf4e1d23b4699acf4e1d23ba69952",
"annotations": [
{
"key": "path",
"value": "whisk.system/alarms/alarm"
},
{
"key": "waitTime",
"value": 114
},
{
"key": "kind",
"value": "nodejs:6"
},
{
"key": "timeout",
"value": false
},
{
"key": "limits",
"value": {
"concurrency": 1,
"logs": 10,
"memory": 256,
"timeout": 60000
}
}
],
"duration": 12,
"end": 1602630229302,
"logs": [],
"name": "alarm",
"namespace": "whisk.system",
"publish": false,
"response": {
"result": {
"error": {
"code": "ENOTFOUND",
"errno": "ENOTFOUND",
"host": "https",
"hostname": "https",
"message": "getaddrinfo ENOTFOUND https https:443",
"name": "Error",
"port": 443,
"stack": "Error: getaddrinfo ENOTFOUND https https:443\n at errnoException (dns.js:28:10)\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)",
"syscall": "getaddrinfo"
}
},
"size": 344,
"status": "application error",
"success": false
},
"start": 1602630229290,
"subject": "whisk.system",
"version": "0.0.1"
}
{
"activationId": "438b0b2ac7ec4c3a8b0b2ac7ecbc3a46",
"annotations": [
{
"key": "path",
"value": "whisk.system/alarms/alarm"
},
{
"key": "waitTime",
"value": 26
},
{
"key": "kind",
"value": "nodejs:6"
},
{
"key": "timeout",
"value": false
},
{
"key": "limits",
"value": {
"concurrency": 1,
"logs": 10,
"memory": 256,
"timeout": 60000
}
}
],
"duration": 17,
"end": 1602630229380,
"logs": [],
"name": "alarm",
"namespace": "whisk.system",
"publish": false,
"response": {
"result": {
"error": {
"code": "ENOTFOUND",
"errno": "ENOTFOUND",
"host": "https",
"hostname": "https",
"message": "getaddrinfo ENOTFOUND https https:443",
"name": "Error",
"port": 443,
"stack": "Error: getaddrinfo ENOTFOUND https https:443\n at errnoException (dns.js:28:10)\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)",
"syscall": "getaddrinfo"
}
},
"size": 344,
"status": "application error",
"success": false
},
"start": 1602630229363,
"subject": "whisk.system",
"version": "0.0.1"
}
ok: deleted trigger mytrigger
The host parameter looked off so I checked the environment configuration, but it looks ok.
root@openwhisk-alarmprovider-fccf54c4f-vxwzf:/# echo $ENDPOINT_AUTH
openwhisk.mydomain.org:443
root@openwhisk-alarmprovider-fccf54c4f-vxwzf:/# echo $ROUTER_HOST
openwhisk.mydomain.org:443
I also verified that DNS does work.
root@openwhisk-alarmprovider-fccf54c4f-dhgll:/# node
> dns.resolve('www.google.com', (error, addresses) => { console.error(error); console.log(addresses); });
QueryReqWrap {
bindingName: 'queryA',
callback: [Function],
hostname: 'www.google.com',
oncomplete: [Function: onresolve],
ttl: false,
domain:
Domain {
domain: null,
_events:
[Object: null prototype] {
removeListener: [Function: updateExceptionCapture],
newListener: [Function: updateExceptionCapture],
error: [Function: debugDomainError] },
_eventsCount: 3,
_maxListeners: undefined,
members: [],
[Symbol(kWeak)]: WeakReference {} },
channel:
ChannelWrap {
domain:
Domain {
domain: null,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
members: [],
[Symbol(kWeak)]: WeakReference {} } } }
> null
[ '216.58.195.68' ]
I'm running this on Openwhisk installed on Kubernetes using the Helm chart, and configured to use the openwhisk/alarmprovider:2.2.0
image. Here is my Helm config (I changed some variables, including the domain, for security reasons):
whisk:
ingress:
domain: openwhisk.mydomain.org
apiHostName: openwhisk.mydomain.org
apiHostPort: 443
apiHostProto: https
type: Standard
# annotations:
# traefik.ingress.kubernetes.io/router.entrypoints: websecure
# traefik.ingress.kubernetes.io/router.tls: "true"
auth:
system: "mysystemtoken"
guest: "myguesttoken"
containerPool:
userMemory: "10240m"
limits:
actionsInvokesConcurrent: 200
actionsInvokesPerminute: 200
triggersFiresPerminute: 200
actions:
time:
max: "60m"
memory:
max: "8192m"
concurrency:
max: 4
k8s:
dns: kube-dns.kube-system
docker:
registry:
name: "myregistry"
username: "myusername"
password: "mypassword"
zookeeper:
replicaCount: 3
kafka:
replicaCount: 3
db:
external: true
wipeAndInit: true
protocol: "http"
host: "couchdb-svc-couchdb.couchdb.svc.cluster.local"
port: 5984
auth:
username: "myusername"
password: "mypassword"
nginx:
httpsNodePort: 443
replicaCount: 3
controller:
replicaCount: 3
invoker:
jvmHeapMB: "2048"
containerFactory:
impl: "docker"
enableConcurrency: true
Any help would be appreciated.
I have openwhisk deployed on a kubernetes cluster. I created a trigger called once-per-minute using this swagger ui,
The curl request: -
curl -X PUT "https://localhost:4430/api/v1/namespaces/_/triggers/once-per-min?overwrite=false" -H "accept: application/json" -H "authorization: Basic Nzg5YzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOmFiY3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A=" -H "Content-Type: application/json" -d "{\"name\":\"once-per-min\",\"annotations\":[{\"key\":\"feed\",\"value\":\"/whisk.system/alarms/alarm\"}]}"
Got Response 200
{
"annotations": [
{
"key": "feed",
"value": "/whisk.system/alarms/alarm"
}
],
"limits": {},
"name": "once-per-min",
"namespace": "whisk.system",
"parameters": [],
"publish": false,
"updated": 1703607489753,
"version": "0.0.1"
}
Now, I tried to create a cron job for the alarm action in whisk.system
curl -X POST "https://localhost:4430/api/v1/namespaces/whisk.system%2Falarms/actions/alarm?blocking=true&result=false" -H "accept: application/json" -H "authorization: Basic Nzg5YzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOmFiY3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A=" -H "Content-Type: application/json" -d "{\"authKey\":\"23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP\",\"cron\":\"*/1 * * * *\",\"lifecycleEvent\":\"CREATE\",\"triggerName\":\"/_/once-per-min\"}"
Got a 502 bad gateway
{
"activationId": "260396828cb84c158396828cb82c15b7",
"annotations": [
{
"key": "path",
"value": "whisk.system/alarms/alarm"
},
{
"key": "waitTime",
"value": 13
},
{
"key": "kind",
"value": "nodejs:10"
},
{
"key": "timeout",
"value": false
},
{
"key": "limits",
"value": {
"concurrency": 1,
"logs": 10,
"memory": 256,
"timeout": 60000
}
}
],
"duration": 38,
"end": 1703607625061,
"logs": [],
"name": "alarm",
"namespace": "whisk.system",
"publish": false,
"response": {
"result": {
"error": {
"error": "Trigger authentication request failed."
}
},
"size": 60,
"status": "application error",
"success": false
},
"start": 1703607625023,
"subject": "whisk.system",
"version": "0.0.1"
}
Tried to read the activation
{
"activationId": "260396828cb84c158396828cb82c15b7",
"annotations": [
{
"key": "path",
"value": "whisk.system/alarms/alarm"
},
{
"key": "waitTime",
"value": 13
},
{
"key": "kind",
"value": "nodejs:10"
},
{
"key": "timeout",
"value": false
},
{
"key": "limits",
"value": {
"concurrency": 1,
"logs": 10,
"memory": 256,
"timeout": 60000
}
}
],
"duration": 38,
"end": 1703607625061,
"logs": [
"2023-12-26T16:20:25.061306357Z stdout: alarm: Error invoking whisk action: 403 { error: 'Trigger authentication request failed.' }"
],
"name": "alarm",
"namespace": "whisk.system",
"publish": false,
"response": {
"result": {
"error": {
"error": "Trigger authentication request failed."
}
},
"size": 60,
"status": "application error",
"success": false
},
"start": 1703607625023,
"subject": "whisk.system",
"version": "0.0.1"
}
https://github.com/openwhisk/openwhisk-package-kafka/blob/master/provider/consumer.py#L317
retry_timeout = 1 # Timeout in seconds
max_retries = 10 # Maximum number of times to retry firing trigger
As previously discussed, we intend to bump the default limit for alarm triggers to 1 million.
Marking critical as users are being affected and we should do this ASAP.
Feature request:
A user would like for a trigger to be fire once at a specific time and date, and optionally delete the trigger after the fire.
One idea for UX could be: (at is UTC based)
wsk trigger create onshot --feed /whisk.system/alarm/once --param at `December 24, 2017 23:30:00`
current stat is to set a cron trigger with maxTrigger of 1, which would cause a lot of problems in terms of cleaning up "dead" triggers and trying to guesstimate when is going to actual fire.
Hi,
I was searching for an existing issue, could not find any.
The problem is that we periodically see that Alarms package is firing the triggers that were deleted. Here is an example:
[2017-09-11T00:45:02.501Z] [INFO] [??] [alarmsTrigger] [deleteTrigger] trigger xxxxxxxx/[email protected]/dummyAlarmsTrigger-1505090685500 successfully deleted from memory
[2017-09-11T00:45:11.357Z] [INFO] [??] [alarmsTrigger] [fireTrigger] Trigger xxxxxxxx/[email protected]/dummyAlarmsTrigger-1505090685500 was successfully fired
I have quickly scanned the code, could not find any obvious reason. Hopefully you could help to shed light here.
Thats the alarmsFeedTests.scala in blue.
Thanks,
Vadim.
The image built based on Dockerfile in the root folder is not runnable now because /logs/alarmsTrigger_logs.log
is not exist.
Below changes are an option to fix this issue.
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,10 +16,11 @@ RUN apt-get update --fix-missing && \
# only package.json
ADD package.json /alarmsTrigger/
RUN cd /alarmsTrigger; npm install
+RUN touch ~/alarmsTrigger_logs.log
# App
ADD provider/. /alarmsTrigger/
EXPOSE 8080
-CMD ["/bin/bash", "-c", "node /alarmsTrigger/app.js >> /logs/alarmsTrigger_logs.log 2>&1"]
+CMD ["/bin/bash", "-c", "node /alarmsTrigger/app.js >> ~/alarmsTrigger_logs.log 2>&1"]
@hassenius commented on Fri Jan 27 2017
The documentation for the alarms package refers to the format of node-cron (for example second field is optional)
https://github.com/openwhisk/openwhisk/blob/master/docs/catalog.md#firing-a-trigger-event-periodically
However, looking at the source, alarms uses the cron package:
https://github.com/openwhisk/openwhisk-package-alarms/blob/master/package.json
Which seems to require 6 fields, etc
Cron package documentation
https://www.npmjs.com/package/cron
@rabbah commented on Fri Feb 24 2017
@csantanapr @jasonpet move?
In action/lib/common.js
and action/alarmWebAction.js
, there are web action responses which the body is bas64 string of JSON. I wonder why the body is base64 string, not the response or error object.
// https://github.com/apache/incubator-openwhisk-package-alarms/blob/master/action/lib/common.js#L100-L104
return {
statusCode: statusCode,
headers: { 'Content-Type': 'application/json' },
body: new Buffer(JSON.stringify(params)).toString('base64')
};
I think the following return statement is more simple:
return {
statusCode: statusCode,
headers: { 'Content-Type': 'application/json' },
body: params
};
After testing with a simple web action, I found the difference between the base64-encoded JSON string body and object body:
{"__ow_method":"get","__ow_headers":{"host":"controllers","user-agent":"curl/7.54.0","accept":"*/*"},"__ow_path":""}
{
"__ow_method": "get",
"__ow_headers": {
"host": "controllers",
"user-agent": "curl/7.54.0",
"accept": "*/*"
},
"__ow_path": ""
}
Is there any intent using base64-encoded JSON string body?
I ran 600 alarms with cron */1 * * * *
on the provider and the thundering herd arised:
All triggers were fired every minute on the minute, so CPU usage of the provider peaked every minutes. I think it could result in harm on management. To deal with the problem, it is necessary to distribute the firings within every minutes.
I suggest adding a few seconds delay before firing.
In my suggestion, two alterations will be needed in part of parameter and scheduler.
In part of parameter, a new paramter strict that takes boolean value is added.
In part of scheduler, It needs a hash function that takes a name as a key and returns an integer in the range of 0 to 59. When the alarm trigger is created, scheduler injects the value that the hash function returns to newTrigger.cron
. For example, if the hash function returns 30 and the cron of the trigger is */10 * * * *
, the cron will be converted like this: 30 */10 * * * *
. It works because the library node-cron
which we used supports sixth field for second.
Using hash function can bring some benefits. Because of the characteristics of hash, we can keep the same delay time among hosts or before and after redeployment of providers without using DB or consensus.
I think the level of peaks decreased if the suggestion is implemented, that leads to keep better condition on the machine running providers. Google uses the similar way to distribute Cron jobs in their systems.
"error": "An error has occurred: TypeError: Cannot read property 'split' of undefined"
is not nice! Let's fix it
@johnsolm - looks like the default trigger limit was updated in the provider code, but that is only relevant if the the alarm feed action does not set maxTriggers. However, the current feed action always sets maxTriggers to 1000 if user did not specify it.
I am seeing some alarms tests fail with a 409 error when attempting to delete an alarm trigger. This is because the alarm is being disabled at the same time as it is being deleted. The delete code needs to do some retries when receiving a 409 during deletion from the database.
sendError() should be call with scope like that.sendError()
cc @jasonpet
the alarm package logs user keys - it should stop doing that.
I tried to use the installCatalog.sh to install this package but I'm not sure what to put for the alarm trigger host and port. I tried using the same ip as my api host and tried a bunch of values for the ports (whatever I found running as a tcp port with docker-proxy) but it's not working. How can I get this package to work for me? The README.md doesn't explain how to install this package. I also tried ./gradlew distDocker which did installs the docker image but doesn't have instructions on how to get the container running.
If the backend returns a 408 (request timed out) when attempting to fire a trigger the provider should not be so eager to delete. Currently, it retries 5 times (should be more) and if it still can't it will delete the trigger. We should not delete on a 408 since there may be a cloudant/couchdb outage. The code needs to be tightened up to only delete when appropriate.
I created alarm trigger with strict=true
wsk trigger create periodic28 \
--feed /whisk.system/alarms/alarm \
--param cron "*/1 * * * *" \
--param trigger_payload "{\"name\":\"Odin\",\"place\":\"Asgard\"}" \
-p strict true
ok: invoked /whisk.system/alarms/alarm with id deb8f8316cbd4be9b8f8316cbd7be9eb
ok: created trigger periodic28
If the strict = true
is given, the cron job should run in 0 seconds, which is actually created with a value of 13 * / 1 * * * *
.
[2020-03-06T04:09:25.695Z] [INFO] [worker1] [lambda-alarm-worker1-test-76cc465994-xsh7j] [alarmsTrigger] [setupFollow] got change for trigger xxxxxxxx/geonhui/periodic28
[2020-03-06T04:09:25.696Z] [INFO] [worker1] [lambda-alarm-worker1-test-76cc465994-xsh7j] [alarmsTrigger] [distributeCronAlarm] xxxxxxxx/geonhui/periodic28 is converted to "13 */1 * * * *"
[2020-03-06T04:09:25.696Z] [INFO] [worker1] [lambda-alarm-worker1-test-76cc465994-xsh7j] [alarmsTrigger] [scheduleCronAlarm] xxxxxxxx/geonhui/periodic28 starting cron job
[2020-03-06T04:09:25.697Z] [INFO] [worker1] [lambda-alarm-worker1-test-76cc465994-xsh7j] [alarmsTrigger] [setupFollow] xxxxxxxx/geonhui/periodic28 created successfully
when I run CLI "./gradlew distDocker", it can not run successfully, the error is as below:
./gradlew distDocker
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at docker_7r8ejptnt4f4tnx46yncyk4ag.run(/home/zhy/iot/incubator-openwhisk-package-alarms/gradle/docker.gradle:43)
FAILURE: Build failed with an exception.
Where:
Build file '/home/zhy/iot/incubator-openwhisk-package-alarms/tests/build.gradle' line: 28
What went wrong:
A problem occurred evaluating project ':tests'.
Could not get unknown property 'sourceSets' for project ':whisktests' of type org.gradle.api.Project.
BUILD FAILED
Total time: 1.51 secs
need to handle the maxTrigger by giving it some default value if not set (default of -1)
We need at least a set of unit tests for a minimum sanity check.
From https://github.com/apache/incubator-openwhisk-package-alarms/blob/master/action/alarm.js#L25
The msg.cron is just taken and input is not validated
The cron
npm package provides a way to check if pattern is valid, without starting the cron job
https://github.com/kelektiv/node-cron#how-to-check-if-a-cron-pattern-is-valid
nano version 6.4.1 introduce a braking change.
apache/couchdb-nano#61
Currently the trigger is being deleted from the DB on certain error scenarios
We need to improve how do we handle each use case, I think there are 3 use cases when firing
When doing operations.
I see the following message
[2017-09-01T14:44:00.507Z] [ERROR] [??] [alarmsTrigger] [fireTrigger] no more triggers left, disabled xxxxxxxx/carlos_dev/trigger2_412345
I was searching for log_level ERROR
and there are too many messages, I believe this is not an error, maybe it should be WARN
or INFO
but not ERROR.
It allows to filter down to real error messages in the provider
All the non-CLI related tests should sunset the wsk, and re-implement them with wskrest.
import common.wsk
val wsk = new Wsk
need to be changed to
import common.rest.WskRest
val wsk = new WskRest
plus there may be changes to the rest of the tests as well, since the response result may have been changed.
Add to the docs
Minutes: 0-59
Hours: 0-23
Day of Month: 1-31
Months: 0-11
Day of Week: 0-6
This is very useful for people to notice the Month and Day of the week is zero based.
Related to apache/openwhisk#1848
User reported on a lifecycle DELETE for /whisk.system/alarms/once
He inspecting logs after the facts and see a few of these but logs don't have good info for debugging like the trigger name.
"2018-01-21T17:09:13.091227454Z stdout: alarm: Error invoking whisk action: 404 { error: 'could not find the trigger in the database' }"
This message is printed in getTrigger function which is called after verifying auth that user owns the trigger, so I think is sane to add the trigger name to the error message
https://github.com/apache/incubator-openwhisk-package-alarms/blob/master/action/lib/Database.js#L79
We need to provide a dev document to guide people who want to install this package to their OpenWhisk.
I am trying to use openwhisk and the alarms package on ubuntu 14 (on one AWS EC2 instance). openwhisk is running well.
I cannot create a trigger with this alarm package, with command
wsk trigger create -i --auth ${auth.whisk.system} perMinute --feed /whisk.system/alarms/alarm --param cron "* * * * *"
with the error code saying
"code": 12268,
"error": "There was an error processing your request."
which doesn't really helpful.
Please let me know if you have any ideas about it.
Here is my settings
Step 1: Install alarm package with installCatalog.sh
WSK_HOME="$HOME/openwhisk"
SYS_AUTH=`cat $WSK_HOME/ansible/files/auth.whisk.system`
DB_HOST=`awk -F "=" '/db_host/ {print $2}' $WSK_HOME/ansible/db_local.ini`
DB_PORT=`awk -F "=" '/db_port/ {print $2}' $WSK_HOME/ansible/db_local.ini`
DB_PREFIX=`awk -F "=" '/db.prefix/ {print $2}' $WSK_HOME/whisk.properties`
EDGE_HOST=`awk -F "=" '/APIHOST/ {print $2}' $HOME/.wskprops`
API_HOST=`awk -F "=" '/APIHOST/ {print $2}' $HOME/.wskprops`
export OPENWHISK_HOME=$WSK_HOME
./installCatalog.sh $SYS_AUTH $EDGE_HOST $DB_HOST:$DB_PORT $DB_PREFIX $API_HOST
It is verified when I use wsk package
to list them
$ wsk package -i --auth ${auth.whisk.system} list
packages
/whisk.system/alarmsWeb private
/whisk.system/alarms shared
...
$ wsk action -i --auth 789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP list
actions
/whisk.system/alarmsWeb/alarmWebAction private nodejs:6
/whisk.system/alarms/alarm private nodejs:6
....
Step 2: Build the alarm provider docker image
./gradlew :distDocker
Step 3: Run the alarm provider docker
set -e
set -x
WSK_HOME=$HOME/openwhisk
DB_PROTOCOL=`awk -F "=" '/db_protocol/ {print $2}' $WSK_HOME/ansible/db_local.ini`
DB_HOST=`awk -F "=" '/db_host/ {print $2}' $WSK_HOME/ansible/db_local.ini`
DB_PORT=`awk -F "=" '/db_port/ {print $2}' $WSK_HOME/ansible/db_local.ini`
DB_USER=`awk -F "=" '/db_username/ {print $2}' $WSK_HOME/ansible/db_local.ini`
DB_PWD=`awk -F "=" '/db_password/ {print $2}' $WSK_HOME/ansible/db_local.ini`
DB_PREFIX=`awk -F "=" '/db.prefix/ {print $2}' $WSK_HOME/whisk.properties`
docker run -d -p 11001:8080 -v $HOME/wsklogs/alarms:/logs \
-e PORT=8080 -e ROUTER_HOST=172.17.0.1 \
-e DB_PREFIX=${DB_PREFIX} -e DB_USERNAME=${DB_USER} \
-e DB_PASSWORD=${DB_PWD} -e DB_HOST=${DB_HOST}:${DB_PORT} \
-e DB_PROTOCOL=${DB_PROTOCOL} whisk/catalog_alarms
The docker is running locally on port 11001, which is verified from docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
....
3b178d6cc3e3 whisk/catalog_alarms "/bin/bash -c 'node /" 15 minutes ago Up 15 minutes 0.0.0.0:11001->8080/tcp infallible_bohr
....
I also have the log, seems pretty good
$ cat wsklogs/alarms/alarmsTrigger_logs.log
[2017-07-27T18:55:12.723Z] [INFO] [??] [alarmsTrigger] [createDatabase] creating the trigger database
[2017-07-27T18:55:12.733Z] [INFO] [??] [alarmsTrigger] [server.listen] Express server listening on port 8080
[2017-07-27T18:55:12.757Z] [INFO] [??] [alarmsTrigger] [createDatabase] created trigger database: ubuntu_ip-10-0-0-42_alarmservice
[2017-07-27T18:55:12.776Z] [INFO] [??] [alarmsTrigger] [initAllTriggers] resetting system from last state
edited:
Add the missed triggerName, which is a editing mistake
Currently, A provider consists of two replications, host0
and host1
.
and I understand that only active hosts can fire trigger.
but, I wonder how to switch active hosts when the active host is dead.
For example, if host0
is dead, how to transfer active status to host1
?
Although /active
exists, there is no client for this.
How do you operate it?
The Utils.js has a hardcoded https as the prefix for this.uriHost:
This means that when using an internal routerHost within k8S, the trigger fails with a:
SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:\n","stack":"Error: write EPROTO 139863444719424:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332
once a feed has exhausted its triggers, should be deleted for convenience?
it might also be nice to infer which triggers are one offs as well and delete them regardless of max trigger since they will not fire again.
When the openwhisk API runs on a different port than 443 it seems that periodic alarms don't work anymore. From the log you can see that the alarm action connects to the default port:
[ERROR] [??] [alarmsTrigger] [postTrigger] there was an error invoking xxxxxxxx/guest/test_alarm {"message":"connect ECONNREFUSED 172.17.0.1:443","stack":"Error: connect ECONNREFUSED 172.17.0.1:443\n at Object._errnoException (util.js:1022:11)\n at _exceptionWithHostPort (util.js:1044:20)\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)","code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"172.17.0.1","port":443}
To adjust the port on install I changed the following:
ROUTER_HOST
in the alarmtrigger containerEDGE_HOST
and API_HOST
provided to ./installCatalog.sh
The installation finished without errors and except from the different port openwhisk runs in default local deployment. Firing a trigger manually works but the cron jobs don't. Any ideas which configuration is missing?
request-promise
adds old version (3.10.1 ) of lodash
as a transitive dependency which has a CRITICAL CVE-2019-10744
Dependency Tree:
.
.
|─ [email protected]
│ |── [email protected]
│ |─┬ [email protected]
│ │ |── [email protected]
│ │ └── [email protected]
│ |── [email protected]
│ └── [email protected]
.
.
Also, there are some HIGH CVEs as well.
The new trigger should accept two new optional parameters.
deleteAfterFire
true
rulesToDelete
deleteAfterFire
is false
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.