Share via


Set-ServiceFabricChaosSchedule

Set the schedule to be used by the Chaos Scheduler.

Syntax

Default (Default)

Set-ServiceFabricChaosSchedule
    -ChaosScheduleDescription <ChaosScheduleDescription>
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

Description

The Set-ServiceFabricChaosSchedule cmdlet sets the schedule to be used by the Chaos Scheduler. The Chaos Scheduler will start running Chaos during based on the specified schedule.

Examples

Example 1

PS C:\> $JobStartTime = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleTimeUtc (0,0)
PS C:\> $JobEndTime = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleTimeUtc (12,59)
PS C:\> $JobTimeRange = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleTimeRangeUtc ($JobStartTime, $JobEndTime)

PS C:\> $activeDays = New-Object -TypeName System.Collections.Generic.HashSet[DayOfWeek]
PS C:\> $activeDays.Add([System.DayOfWeek]::Monday)
PS C:\> $activeDays.Add([System.DayOfWeek]::Tuesday)
PS C:\> $activeDays.Add([System.DayOfWeek]::Wednesday)
PS C:\> $activeDays.Add([System.DayOfWeek]::Thursday)
PS C:\> $activeDays.Add([System.DayOfWeek]::Friday)
PS C:\> $JobActiveDays = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleJobActiveDays ($activeDays)

PS C:\> $JobActiveTimes = New-Object -TypeName System.Collections.Generic.List[System.Fabric.Chaos.DataStructures.ChaosScheduleTimeRangeUtc]
PS C:\> $JobActiveTimes.Add($JobTimeRange)
PS C:\> $Job = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleJob ("adhoc", $JobActiveDays, $JobActiveTimes)
PS C:\> $Jobs.Add($Job)

PS C:\> $ChaosParameters = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosParameters
PS C:\> $ChaosParametersDictionary = New-Object 'System.Collections.Generic.Dictionary[string,System.Fabric.Chaos.Datastructures.ChaosParameters]'
PS C:\> $ChaosParametersDictionary.Add("adhoc", $ChaosParameters)

PS C:\> $Now = Get-Date
PS C:\> $StartTime = $Now.ToUniversalTime()
PS C:\> $EndTime = $StartTime.AddDays(100)
PS C:\> $ChaosSchedule = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosSchedule ($StartTime, $EndTime, $ChaosParametersDictionary, $Jobs)

PS C:\> $ChaosScheduleDescription = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleDescription (0, $ChaosSchedule)
PS C:\> Set-ServiceFabricChaosSchedule -ChaosSchedule $ChaosScheduleDescription

Set a schedule that specifies Chaos to be ran 24 hours a day starting Monday and ending Friday (based on UTC timezone). This schedule will remain active for 100 days, during which, the Chaos Scheduler will follow this schedule to run Chaos. To stop the schedule, use the Stop-ServiceFabricChaos cmdlet.

Parameters

-ChaosScheduleDescription

The schedule that will be set for the Chaos Scheduler to use.

Parameter properties

Type:ChaosScheduleDescription
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TimeoutSec

Specifies the timeout period, in seconds for the operation.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

System.Object