Condividi tramite


Set-ServiceFabricChaosSchedule

Impostare la pianificazione da usare dall'utilità di pianificazione Chaos.

Sintassi

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

Descrizione

Il cmdlet Set-ServiceFabricChaosSchedule imposta la pianificazione da usare dall'utilità di pianificazione Chaos. Chaos Scheduler inizierà a eseguire Chaos durante la pianificazione specificata.

Esempio

Esempio 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

Impostare una pianificazione che specifica che Chaos deve essere eseguita 24 ore al giorno a partire da lunedì e fine venerdì (in base al fuso orario UTC). Questa pianificazione rimarrà attiva per 100 giorni, durante la quale il Chaos Scheduler seguirà questa pianificazione per eseguire Chaos. Per arrestare la pianificazione, usare il cmdlet Stop-ServiceFabricChaos .

Parametri

-ChaosScheduleDescription

Pianificazione che verrà impostata per l'uso di Chaos Scheduler.

Type:ChaosScheduleDescription
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-TimeoutSec

Specifica il periodo di timeout, in secondi per l'operazione.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Input

None

Output

System.Object