IScheduledTaskProperties.Class_

Fore Syntax

Class_: Integer;

Fore.NET Syntax

@Class: Integer;

Description

The Class_ property determines the class of the task that is executed in task scheduler.

Comments

An individual queue is formed for each task class in the scheduler. The number of streams is distributed by "equal parts" between the task classes.

Fore Example

Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINER identifier.

Sub Main;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    Exe: IExecuteSubScheduledTask;
    Per: IScheduledTaskPeriodDaily;
    Prop: IScheduledTaskProperties;
    Date: DateTime;
Begin
    MB := MetabaseClass.Active;
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_EXECUTESUB;
    CrInfo.Id := "MODULE_EXECUTOR";
    CrInfo.Name := "Unit execution";
    CrInfo.Parent := MB.ItemById("TASK_CONTAINER");
    MObj := MB.CreateObject(CrInfo).Edit;
    Exe := MObj As IExecuteSubScheduledTask;
    Exe.Assembly := (MB.ItemById("Module_1").Bind As IModule).Assembly;
    Exe.SubName := "Main";
    Prop := Exe.Properties;
    Per := Prop.CreatePeriod(ScheduledTaskPeriodType.Daily) As IScheduledTaskPeriodDaily;
    Per.EveryDays := 3;
    Date := DateTime.Now;
    Per.StartDateTime := Date.Compose(Date.Year, Date.Month, Date.Day, 12000);
    Per.StopDateTime := DateTime.AddMonths(Per.StartDateTime, 2);
    Prop.Period := Per;
    Prop.Class_:=2;
    MObj.Save;
End Sub Main;

After executing the example the unit execution task named Unit Execution is created and is given class 2.

Fore.NET Example

Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINER identifier.

Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.KeFore;

Public
 Shared Sub Main(Params : StartParams);
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    Exe: IExecuteSubScheduledTask;
    Per: IScheduledTaskPeriodDaily;
    Prop: IScheduledTaskProperties;
    Date: DateTime;
Begin
    MB := Params.Metabase;
    CrInfo := MB.CreateCreateInfo();
    CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_EXECUTESUB As Integer;
    CrInfo.Id := "MODULE_EXECUTOR";
    CrInfo.Name := "Unit execution";
    CrInfo.Parent := MB.ItemById["TASK_CONTAINER"];
    MObj := MB.CreateObject(CrInfo).Edit();
    Exe := MObj As IExecuteSubScheduledTask;
    Exe.Assembly := (MB.ItemById["Module_1"].Bind() As IModule).Assembly;
    Exe.SubName := "Main";
    Prop := Exe.Properties;
    Per := Prop.CreatePeriod(ScheduledTaskPeriodType.stptDaily) As IScheduledTaskPeriodDaily;
    Per.EveryDays := 3;
    Per.StartDateTime :=  DateTime.Now;
    Per.StopDateTime := Per.StartDateTime.AddMonths(2);
    Prop.Period := Per;
    Prop.@Class:=2;
    MObj.Save();
End Sub;

After executing the example the unit execution task named Unit Execution is created and is given class 2.

See also:

IScheduledTaskProperties