Skip to content

Plans

Once you have a valid job configuration, your next issue is to schedule it for automatic execution. The PunchPlatform lets you completely define the periodic scheduling of your jobs, again using simple configuration files called plans.

To explain it straight, a plan is about generating dates, then scheduling your job using these dates. Why dates ? because the essential parameters for selecting input data is based on time.

The following diagram illustrates the way it works. Your job configuration file is actually a template file. The plan will be in charge of periodically defining some date values, then generating actual job files from the templates, in turn scheduled for execution.

image

Dates Configuration

Before we describe a complete plan configuration file, let us explain how you generate dates. You define two-fields configuration elements:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
    # Mandatory : ISO 8601 format used for generating your date value
    "format": "yyyy-MM-dd'T'HH:mmZ",

    # Optional : you can define an optional duration relative to the execution data.
    # This will be used to shift the date.
    #
    # Here we generate a date with a two minutes shift from the cron date.
    "duration": "-PT2m"
}

Both the duration and format accepted values follow the ISO 8601 standard.

Settings

  • format : String

    ISO 8601 Format used for generating your date value

  • duration : String

    ISO 8601 duration shift from the cron date

Example

Execution Date duration format Result
2017-12-05T10:30:00.000+01:00 -PT2m yyyy-MM-dd’T’HH:mmZ 2017-12-05T10
2017-12-05T10:30:00.000+01:00 XXX +01:00
2017-12-05T10:30:00.000+01:00 yyyy.MM.dd 2017.12.05

Plan Configuration

Plan configuration files contain all the informations required to iteratively generated jobs with the right date time ranges.

Settings

  • cron : String

    Mandatory: Cron expression defining the scheduling

  • start: String

    Now Start date at format "yyyy-MM- dd'T'HH:mmZ"

  • stop : String

    Stop date at format "yyyy-MM- dd'T'HH:mmZ"

  • delay : String

    Duration between execution date and job launching

  • dates : List

    List of date templating

  • configurations: Json

    Context add to templatting

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
    "cron": "*/1 * * * *",
    "delay": "PT10s",
    "dates": {
        "fit_from": {
            "duration": "-PT2m",
            "format": "yyyy-MM-dd'T'HH:mmZ"
        },
        "fit_to": {
            "duration": "-PT1m",
            "format": "yyyy-MM-dd'T'HH:mmZ"
        },
        "fit_day": {
            "duration": "-PT2m",
            "format": "yyyy.MM.dd"
        },
        "transform_from": {
            "duration": "-PT1m",
            "format": "yyyy-MM-dd'T'HH:mmZ"
        },
        "transform_to": {
            "format": "yyyy-MM-dd'T'HH:mmZ"
        },
        "transform_day": {
            "duration": "-PT1m",
            "format": "yyyy.MM.dd"
        },
        "timezone": {
            "format": "a_valid_format_based_on_your_node"
        }
    },
    "configurations": {
        "index_input": "mytenant-events",
        "index_output": "result-mytenant-events",
        "cluster_name": "es_search",
        "nodes": [
            "localhost"
        ]
    }
}

Note

The library used for templating is Jtwig a template engine similar to Jinja2 and its Json extension.

Plan Execution

To learn how to use PunchPlatform Plan in pratice, please refer to the dedicated Plans Executions operations guide.