Kettle How the background process performs configuration

Source: Internet
Author: User

Original link

1, Introduction kettle kitchen and span

The first two articles mainly about the transformation of the kettle Spoon and the GUI design of the operation and the operation, also give the demo, then in fact, our application mode may require the server to run as a background process of the ETL task, Just as we traditionally use Windows services to process data, how do we do it with kettle? This will require us to understand Kettle's kitchen and span.

kitchen--work (Job) executor (command line mode)
span--conversion (trasform) Actuator (command line mode)

Here we focus on the Kitchen.bat job executor , which is often used.

It is a job execution engine used to execute the job. This is a command-line execution tool, and its parameters are described below:

-rep:repository Name of the task package where it is stored
-user:repository Username Executive Person
-pass:repository Password Code of execution person
-job:the name of the job to launch task pack
-dir:the directory (don ' t forget the leading/or \)
-file:the filename (Job XML) to launch
-level:the logging Levels (Basic, detailed, Debug, Rowlevel, Error, nothing) specify the log level
-log:the logging file to write to specify log files
-listdir:list the directories in the repository lists the directory structure in the specified store.
-listjobs:list the jobs in the specified directory lists all tasks under the specified directory
-listrep:list The defined repositories lists all the storage
-norep:don ' t log into the repository does not write log

2, command line scheduling task configuration mode

Or take the first example I mentioned in the previous article to go to the specific configuration, the main idea is to locate the root directory of the Kitchen.bat in kettle, and then execute the kitchen command;

Step 1: First we create a bat file, and then click Edit to enter, as shown below, this is the directory to locate the Kitchen.bat;

E:CD E:\ETL\pdi-open-3.1.0-826

Step 2: Execute the kitchen command as follows:

kitchen/file:e:\etl\ script File \mytest.kjb/level:basic>>d:\mytest.log

Note here with the correct path, followed by a basic log mode, followed by the configuration of the log output path;

3. Background process Configuration Run mode

We have already set up the bat file in front of us, we can run our ETL task in bat mode, but the problem is that there is always a black cmd screen on the server desktop, and it can't be shut down, how to make the bat disappear on the screen and run in the background? There are a number of ways to introduce two kinds of specific methods:

Method One

BAT has a hidden window command, very simple, just need to add a piece of code at the head of the code on it.

@echo off

If "%1" = = "h" goto begin

Mshta vbscript:createobject ("Wscript.Shell"). Run ("%~nx0 h", 0) (window.close) &&exit

: Begin

:: Here is your own code.

Method Two

Create a new Notepad in the same directory as your batch and enter:

DIM Objshell Set Objshell=wscript.createobject ("Wscript.Shell")

Ireturn=objshell.run ("cmd.exe/c C:\1.bat", 0, TRUE)

(where Win.bat for your own batch name, change yourself)

Then save this notepad as a file with the suffix. VBE, and then you can just run the VBE file to achieve your goal!

A simple point to write:

Set ws = CreateObject ("Wscript.Shell")

Ws.run "cmd/c C:\1.bat", 0

Or

CreateObject ("Wscript.Shell"). Run "cmd/c C:\1.bat", 0

(This kind of writing a lot of kill the poison, need to replace the parameter 0)

The last 0 refers to the window parameters, using:

0 hide the window and activate another window.

1 Activates and displays a window. If the window is minimized or maximized, it reverts to its original size and position.

2 Activates the window and displays it in a minimized format.

3 Activates the window and displays the window to maximize it.

4 Displays the nearest size and position of the window. The active window remains active.

5 Activates and displays the window at the current size and position.

6 minimizes the specified window and activates the Next top-level window sorted by Z-order.

7 Minimize the display window. The active window remains active.

8 Displays the window in its current state. The active window remains active.

9 activates and displays the window. If the window is minimized or maximized, it reverts to its original size and position. This flag should be specified when the minimized window of the application is restored.

4. Windows task settings

After the previous two steps, we have been able to let ETL job on the server silently run, but how to free dispatch, we combine the Windows Task plan can, here no longer repeat!

5. Demo download

ETL script. bat

Kettle How the background process performs configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.