- Overview
- Tutorials
- How Tos
- Download
- Install
- Configure
- Secure
- TLS API Configuration
- Configure API Authentication and Authorization with JWT
- Configure API Limits
- Set Resource Limits
- Crypto key management
- Restrict key usage
- Namespace Key Management
- Key management service (KMS) configuration
- Optimize
- Observe
- Operate
- Initializing node identity manually
- Canton Console
- Synchronizer connections
- High Availability Usage
- Manage Daml packages and archives
- Participant Node pruning
- Party Management
- Party Replication
- Decentralized party overview
- Setup an External Party
- Ledger API User Management
- Node Traffic Management
- Identity Management
- Upgrade
- Decommission
- Recover
- Troubleshoot
- Explanations
- Reference
Automatic Pruning¶
The following functions are available to set, modify, and read the pruning schedule:
// Set a pruning schedule with a duration and a retention period.
pruning.set_schedule("0 0 8 ? * SAT", 8.hours, 90.days)
// Retrieve the current pruning schedule returning `None` if no schedule is set.
val pruningSchedule = pruning.get_schedule()
// Set individual fields to modify the existing pruning schedule.
pruning.set_cron("0 /5 * * * ?")
pruning.set_retention(30.days)
pruning.set_max_duration(2.hours)
// Clear the pruning schedule disabling automatic pruning on a specific node.
pruning.clear_schedule()
Refer to the cron specification to customize the pruning schedule. Here are a few examples:
// Prune every evening at 8pm GMT for two hours
set_schedule("0 0 20 * * ?", 2.hours, retention)
// Prune every 5 minutes for one minute
set_schedule("0 /5 * * * ?", 1.minute, retention)
// Prune for one specific day
set_schedule("0 0 0 31 12 ? 2025", 1.day, retention)
For the maximum duration to specify a reliable pruning window end time, the leading fields of the cron expression must not be wildcards (*), as illustrated in the preceding examples. If the hour field is fixed, the fields for the minute and the second must be fixed too.
Schedule format¶
Cron expressions are formatted as seven whitespace-separated fields:
Field |
Type and valid values* |
---|---|
seconds |
number from |
minutes |
number from |
hours |
number from |
day of the month |
number from |
month |
number from |
day of the week |
number from |
year (optional) |
number from |
*Ranges specified with “from .. to ..” are inclusive of both endpoints.
Note that, although a day-of-the-month value might be valid according to the preceding definition, it might not correspond to an actual date in certain months (such as the thirty-first of November). If you schedule pruning for the thirty-first of the month, every month with fewer than 31 days is skipped.
Advanced schedule formatting¶
You can construct lists and ranges of values. For example, the day of the week could be a range like
MON-FRI
to refer to the days Monday through Friday, orTUE,FRI
to refer to Tuesday and Friday exclusively. Or you could use a mix of both, for example,MON,WED-FRI
, meaning “Monday, and also Wednesday through Friday.”Use the asterisk (
*
) as a wildcard that means “all possible values.”Use the question mark (
?
) as a wildcard that means “any value” in the day-of-the-month and day-of-the-week fields. For example, to specify “every Monday at noon,” use the?
character to indicate that any day of the month is valid:0 0 12 ? * MON
To apply increments to numeric values, use the slash character (
/
). For example, a value of1/2
in the hours field means “every two hours starting from 1 AM” (1 AM, 3 AM, 5 AM, etc).
Here are some examples of valid schedules:
0 30 * * * *
Every hour at half past0 5/15 12,18-20 * * *
Every fifteen minutes, starting from five past, at noon and from 6 to 8 PM0 5/15 12,18-20 ? * MON,THU
Same as above, but only on Mondays and Thursdays0 0 22 1 * ?
Every first day of the month at 10 PM
For more information about cron expressions, see the Apache Log4j API documentation.