This is a beginner's guide to the Job Execution Framework.
We have provided the flex-jefexampleexecutor-service project with a comprehensive number of plugin scenarios.
For more information on how to access https://github.com/dalet-oss/flex-jefexampleexecutor-service, please contact your Dalet representative.
See https://github.com/dalet-oss/flex-jefexampleexecutor-service/
Running flex-jefexampleexecutor-service
To set up the framework for JEF, you must do the following:
- Install Docker:
- Acquire a login to the docker registry. Please contact the Dalet Flex team to acquire access. Once you have obtained this information, you can use the docker login registry.ooflex.net command to log in.
- Clone the following repo: https://github.com/dalet-oss/flex-jefexampleexecutor-service
-
Configure the dynamic FLEX_IP value by running the bash_profile (in MAC), after setting the FLEX_IP property:
export FLEX_IP= 'ifconfig | grep -Eo 'inet (addr:)?([0-9]_.){3}[0-9]_' | grep -Eo '([0-9]_.){3}[0-9]_' | grep -v '127.0.0.1' | grep -v '192.168.1'>
-Add the following entries in your host file, in order to run the Consul and Enterprise services:
127.0.0.1 localhost
Additionally, you will need a similar configuration to connect to the Enterprise site:
<DOCKER IP> mysqlhost dockermachine consul
- Flex Enterprise can be started independently of JEF services - neither needs to be started before the other. Flex Enterprise will be notified when the JEF Registry Service is running, and reports will be available on Action Plugins and their status.
Once an action plugin has been deployed, it appears in the list of existing actions in the Dalet Flex console, ready for people to make use of. -
Run
-Build and start flex-jefexampleexecutor-service within a Flex environment running JEF.
-Create, configure and enable a new Action using any of the plugin registered in Enterprise
-Launch a job using REST API, UI or as part of a workflow execution
Base step to create an Action Plugin
Step 1: Creating the Action Configuration
Most of the plugins found in Dalet Flex require you to populate configuration fields. In most cases, there are mandatory fields that must be filled out in order for the plugin to function correctly. These are found under the Configuration tab when you view a plugin in the Dalet Flex user interface. Defining the Action Configuration
To begin creating the configuration for the plugin, you must create a class that implements the ActionConfiguration interface:
Example 1: You could create a “Send Email” action. This action could contain the following fields: Recipient's Email, Subject, and Message.
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.ALWAYS)
@ActionPluginConfiguration(description = "Email details needed by the Notification-Email-Action")
public class EmailActionConfiguration implements ActionConfiguration {
@ConfigField(
displayName = "Recipent's Email",
description = "Person to receive email",
required = true)
private String recipientEmail;
@ConfigField(
displayName = "Subject",
description = "Email subject line",
required = true)
private String subject;
@ConfigField(
displayName = "Message",
description = "Email's body",
required = true)
private String body;
}
You can design the configuration of a plugin using the metadata annotations provided as part of JEF (these are effectively Dalet Flex metadata definitions). These annotations provide solutions to define native, primitive, and complex fields.
Example 2: In a transcode plugin you might see a complex called “Destination”. Within the “Destination” complex you would find destination related fields such as: Folder Resource, VFSLocation, Protocol, Hostname, and so on.
Step 2: Creating an Action Executor
Extend the ActionExecutor abstract class and implement execute(..) method.
Example:
@Override
public ActionExecutorResponse execute() { log.info("JEF Example external email action started execution for job");
EmailExternalActionConfiguration emailActionConfiguration = (EmailExternalActionConfiguration) actionConfiguration; ... // Sends email
emailUtils.sendEmail(emailActionConfiguration.getRecipientEmail(), emailActionConfiguration.getSubject(),
emailActionConfiguration.getBody()); log.info("JEF Example external email action done"); return new ActionExecutorResponse();
}
Comments
0 comments
Please sign in to leave a comment.