Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Scheduler job in Firefly / Runtime

eldhov19157560
Level 3
Level 3

Hi Team,

 

We would like to use a scheduler job in firefly app, we found the following option https://github.com/apache/openwhisk-package-alarms is there any alternate option in firefly?

firefly scheduler scheduling
10 Replies
SarahXu
Level 3
Level 3

Hi @eldhov19157560,

 

Yes the alarm package is available.

 

You can read more about it here https://github.com/AdobeDocs/adobeio-runtime/blob/33d0979a45b9e35e8addaad7e97dfb00f8ea5e12/reference...

 

The documentation shows an example for directly using the cli to set up triggers, but you can easily define the trigger through the manifest file. Here's an example manifest file for that. 

 

 

Manifest File Example: “Hello world” Action with a compatible Trigger and Rule

package:
  name: hello_world_package
  version: 1.0
  license: Apache-2.0
  actions:
    hello_world_triggerrule:
      function: src/hello_plus.js
      runtime: nodejs
      inputs:
        name: string
        place: string
        children: integer
        height: float
      outputs:
        greeting: string
        details: string

  triggers:
    meetPerson:
      inputs:
        name: Sam
        place: the Shire
        children: 13
        height: 1.2

  rules:
    meetPersonRule:
      trigger: meetPerson
      action: hello_world_triggerrule
ursboller
Community Advisor
Community Advisor
Hi @SarahXu how would my trigger look like if I want to have it triggered daily as a cron job?
ursboller
Community Advisor
Community Advisor
@SarahXu can I use the "Triggers" in the manifest file to create the scedule? and how would the structure look like?
SarahXu
Level 3
Level 3
comment makes it a bit difficult to lay out code but it should look something like this ``` triggers: \ sample-trigger: \ feed: /whisk.system/alarms/alarm \ cron: "0 * * * *
SarahXu
Level 3
Level 3

comment makes it a bit difficult to lay out code but it should look something like this

 

triggers: 
    sample-trigger:
       feed: /whisk.system/alarms/alarm
       cron: 0 * * * * 
       trigger_payload: {"name":"Vlad","place":"Transylvania"}
       startDate: xxxx
       stopDate: xxxx

 

you can see https://github.com/AdobeDocs/adobeio-runtime/blob/33d0979a45b9e35e8addaad7e97dfb00f8ea5e12/reference... for some more example on the rules you can use for the alarm package

 

ursboller
Community Advisor
Community Advisor

@SarahXu I don't think the provided pattern works, at least I received errors when using the code in my manifest.yml file.

After some testing I think the pattern using openWhisk alarms should be something like this:

 

...
triggers:
  myCustomTriggerName:
    feed: /whisk.system/alarms/alarm
    inputs: 
      cron: '* * * * *'
      start-date: ''2020-08-30T13:37:00.00Z'
      stop-date: '2020-08-30T12:50:00.000Z'
...

 

 could you please check what the right pattern is to use in the manifest.yml file? thanks

SarahXu
Level 3
Level 3
You are correct! Thank you -- sorry for missing the `input` block before the params.
ursboller
Community Advisor
Community Advisor

based on the idea from @SarahXu I found this blog post and it exactly describes the steps to make within the app: https://medium.com/openwhisk/whisk-deploy-alarm-trigger-6c0984b06745