Creating a New User Job

Jobs are defined in the Fabric Studio and can be saved to a project file and be deployed to the Fabric Server. A Job can be a Java function or a simple command.

How Do I Create a New User Job?

Step 1

Go to the Project Tree > LU > Java > Category and right click New Function to display the Function Editor window.

Step 2

Write the User Job function either from:

  • the Function Editor window.
  • IntelliJ IDE.
//writing into a file;

while (test<5 && !isAborted()){
    test=test+1;
    sleep(10000);
    inSecTime=test*10; // value returned by user job function
    FileWriter myWriter = new FileWriter("job_test4.txt",true);
    myWriter.write("Test Number: "+ test +"::->" + 10*test + " seconds have passed since ...");
    myWriter.close();
    }

Step 3

Set the Function Type to the User Job value in the right panel. Once the job is triggered, the following Java user code writes a line into a new file job_test.txt every second until the counter test reaches the value 5. The output file is located in the Fabric Home directory.

Note that the loop control parameter (variable test) is defined as an input parameter of the User Job function, and that a second variable inSecTime is also defined as an output parameter. As such, its value is recorded in the argument field of the k2_jobs table in the k2system keyspace.

Name and save the function.

Step 4

Go to the Project Tree > your LU > Jobs.

Jobs can be created also as References regardless of the specific LU. In the Job table, enter the values pertaining to the Job.

Method The name of the User Job Function (defined in Step 4) associated with the Job.
Unique Job Name The unique name of the Job service used for all manual or system operations executed on this job.
Execution Mode Can be set either automatically or manually depending on whether the Job service is started from the Command Line or job will start automatically upon deployment.
Active When checked, the Job is run and deployed.
Schedule Type

There are three schedule modes:

  • CRON, runs the Job according to the frequency described in the Cron description tab.
    For example, set the execution to: 30 0/2 8-18 5 3 ? 2021 at 30 seconds past the minute (30), every 2 minutes (0/2), between 08:00 and 18:59 (8-18), on day 5 of the month (5), only in March (3), only in year 2021 (2021).

  • TimeStamp, schedules a Job to run once on a given date and time. For example, set the execution to 2022-08-20 10:32:12.

  • Time Interval, schedules the Job to run at the frequency specified in the Execute Every field: For example, set the execution to: 10.11:22:33. the jobT runs every 10 days, 11 hours, 22 minutes, 33 seconds. If the time interval is set to 00:00:00, the job runs once automatically.

    It is important to note that if a scheduled job is started manually (before its scheduled occurance) then its next scheduled occurance will still start on time, unless the previous manual occurance of the job is still running.

Affinity

The details of the node assigned to the job. Affinity can be set using either one of the following options:

  • IP address of a Fabric node.
  • Data Center (DC) Name.
  • Node identifier, a logical identifier of Fabric node or a group of several Fabric nodes.

Example: AFFINITY=’DC1’, ’10.21.1.121’

Input parameters

Defines where the values of the input parameters are initialized. In this case the variable *test* is set to 0.

(The output parameter value is recorded in the argument field of the k2_jobs table in the k2system keyspace.)

 

Step 5

Right click the LU in the Project Tree, deploy and then search for the file in the Fabric Home directory.

Previous

Creating a New User Job

Jobs are defined in the Fabric Studio and can be saved to a project file and be deployed to the Fabric Server. A Job can be a Java function or a simple command.

How Do I Create a New User Job?

Step 1

Go to the Project Tree > LU > Java > Category and right click New Function to display the Function Editor window.

Step 2

Write the User Job function either from:

  • the Function Editor window.
  • IntelliJ IDE.
//writing into a file;

while (test<5 && !isAborted()){
    test=test+1;
    sleep(10000);
    inSecTime=test*10; // value returned by user job function
    FileWriter myWriter = new FileWriter("job_test4.txt",true);
    myWriter.write("Test Number: "+ test +"::->" + 10*test + " seconds have passed since ...");
    myWriter.close();
    }

Step 3

Set the Function Type to the User Job value in the right panel. Once the job is triggered, the following Java user code writes a line into a new file job_test.txt every second until the counter test reaches the value 5. The output file is located in the Fabric Home directory.

Note that the loop control parameter (variable test) is defined as an input parameter of the User Job function, and that a second variable inSecTime is also defined as an output parameter. As such, its value is recorded in the argument field of the k2_jobs table in the k2system keyspace.

Name and save the function.

Step 4

Go to the Project Tree > your LU > Jobs.

Jobs can be created also as References regardless of the specific LU. In the Job table, enter the values pertaining to the Job.

Method The name of the User Job Function (defined in Step 4) associated with the Job.
Unique Job Name The unique name of the Job service used for all manual or system operations executed on this job.
Execution Mode Can be set either automatically or manually depending on whether the Job service is started from the Command Line or job will start automatically upon deployment.
Active When checked, the Job is run and deployed.
Schedule Type

There are three schedule modes:

  • CRON, runs the Job according to the frequency described in the Cron description tab.
    For example, set the execution to: 30 0/2 8-18 5 3 ? 2021 at 30 seconds past the minute (30), every 2 minutes (0/2), between 08:00 and 18:59 (8-18), on day 5 of the month (5), only in March (3), only in year 2021 (2021).

  • TimeStamp, schedules a Job to run once on a given date and time. For example, set the execution to 2022-08-20 10:32:12.

  • Time Interval, schedules the Job to run at the frequency specified in the Execute Every field: For example, set the execution to: 10.11:22:33. the jobT runs every 10 days, 11 hours, 22 minutes, 33 seconds. If the time interval is set to 00:00:00, the job runs once automatically.

    It is important to note that if a scheduled job is started manually (before its scheduled occurance) then its next scheduled occurance will still start on time, unless the previous manual occurance of the job is still running.

Affinity

The details of the node assigned to the job. Affinity can be set using either one of the following options:

  • IP address of a Fabric node.
  • Data Center (DC) Name.
  • Node identifier, a logical identifier of Fabric node or a group of several Fabric nodes.

Example: AFFINITY=’DC1’, ’10.21.1.121’

Input parameters

Defines where the values of the input parameters are initialized. In this case the variable *test* is set to 0.

(The output parameter value is recorded in the argument field of the k2_jobs table in the k2system keyspace.)

 

Step 5

Right click the LU in the Project Tree, deploy and then search for the file in the Fabric Home directory.

Previous