Search in sources :

Example 41 with JobEntryCopy

use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.

the class JobExecutionConfigurationDialog method getInfo.

public void getInfo() {
    try {
        getConfiguration().setExpandingRemoteJob(wExpandRemote.getSelection());
        getConfiguration().setRunConfiguration(wRunConfiguration.getText());
        // various settings
        // 
        configuration.setReplayDate(null);
        configuration.setSafeModeEnabled(wSafeMode.getSelection());
        configuration.setClearingLog(wClearLog.getSelection());
        configuration.setLogLevel(LogLevel.values()[wLogLevel.getSelectionIndex()]);
        String startCopyName = null;
        int startCopyNr = 0;
        if (!Utils.isEmpty(wStartCopy.getText())) {
            if (wStartCopy.getSelectionIndex() >= 0) {
                JobEntryCopy copy = ((JobMeta) abstractMeta).getJobCopies().get(wStartCopy.getSelectionIndex());
                startCopyName = copy.getName();
                startCopyNr = copy.getNr();
            }
        }
        getConfiguration().setStartCopyName(startCopyName);
        getConfiguration().setStartCopyNr(startCopyNr);
        // The lower part of the dialog...
        getInfoParameters();
        getInfoVariables();
        // Metrics
        configuration.setGatheringMetrics(wGatherMetrics.getSelection());
    } catch (Exception e) {
        new ErrorDialog(shell, "Error in settings", "There is an error in the dialog settings", e);
    }
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) KettleException(org.pentaho.di.core.exception.KettleException)

Example 42 with JobEntryCopy

use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.

the class JobExecutionConfigurationDialog method getData.

public void getData() {
    wSafeMode.setSelection(configuration.isSafeModeEnabled());
    wClearLog.setSelection(configuration.isClearingLog());
    wExpandRemote.setSelection(getConfiguration().isExpandingRemoteJob());
    wLogLevel.select(DefaultLogLevel.getLogLevel().getLevel());
    wGatherMetrics.setSelection(configuration.isGatheringMetrics());
    List<String> runConfigurations = new ArrayList<>();
    try {
        ExtensionPointHandler.callExtensionPoint(Spoon.getInstance().getLog(), KettleExtensionPoint.SpoonRunConfiguration.id, new Object[] { runConfigurations, JobMeta.XML_TAG });
    } catch (KettleException e) {
    // Ignore errors
    }
    wRunConfiguration.setItems(runConfigurations.toArray(new String[0]));
    if (!runConfigurations.contains(getConfiguration().getRunConfiguration())) {
        getConfiguration().setRunConfiguration(null);
    }
    if (Utils.isEmpty(getConfiguration().getRunConfiguration())) {
        wRunConfiguration.select(0);
    } else {
        wRunConfiguration.setText(getConfiguration().getRunConfiguration());
    }
    String startCopy = "";
    if (!Utils.isEmpty(getConfiguration().getStartCopyName())) {
        JobEntryCopy copy = ((JobMeta) abstractMeta).findJobEntry(getConfiguration().getStartCopyName(), getConfiguration().getStartCopyNr(), false);
        if (copy != null) {
            startCopy = getJobEntryCopyName(copy);
        }
    }
    wStartCopy.setText(startCopy);
    getParamsData();
    getVariablesData();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobMeta(org.pentaho.di.job.JobMeta) ArrayList(java.util.ArrayList)

Example 43 with JobEntryCopy

use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.

the class JobExecutionConfigurationDialog method optionsSectionControls.

protected void optionsSectionControls() {
    wExpandRemote = new Button(gDetails, SWT.CHECK);
    wExpandRemote.setText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.ExpandRemote.Label"));
    wExpandRemote.setToolTipText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.ExpandRemote.Tooltip"));
    props.setLook(wExpandRemote);
    FormData fd_expandCheckButton = new FormData();
    fd_expandCheckButton.top = new FormAttachment(0, 10);
    fd_expandCheckButton.left = new FormAttachment(0, 10);
    wExpandRemote.setLayoutData(fd_expandCheckButton);
    wClearLog = new Button(gDetails, SWT.CHECK);
    wClearLog.setText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.ClearLog.Label"));
    wClearLog.setToolTipText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.ClearLog.Tooltip"));
    props.setLook(wClearLog);
    FormData fdClearLog = new FormData();
    fdClearLog.top = new FormAttachment(wExpandRemote, 10);
    fdClearLog.left = new FormAttachment(0, 10);
    wClearLog.setLayoutData(fdClearLog);
    wSafeMode = new Button(gDetails, SWT.CHECK);
    wSafeMode.setText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.SafeMode.Label"));
    wSafeMode.setToolTipText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.SafeMode.Tooltip"));
    props.setLook(wSafeMode);
    FormData fdSafeMode = new FormData();
    fdSafeMode.top = new FormAttachment(wClearLog, 7);
    fdSafeMode.left = new FormAttachment(0, 10);
    wSafeMode.setLayoutData(fdSafeMode);
    wGatherMetrics = new Button(gDetails, SWT.CHECK);
    wGatherMetrics.setText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.GatherMetrics.Label"));
    wGatherMetrics.setToolTipText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.GatherMetrics.Tooltip"));
    props.setLook(wGatherMetrics);
    FormData fdGatherMetrics = new FormData();
    fdGatherMetrics.top = new FormAttachment(wSafeMode, 7);
    fdGatherMetrics.left = new FormAttachment(0, 10);
    fdGatherMetrics.bottom = new FormAttachment(100, -10);
    wGatherMetrics.setLayoutData(fdGatherMetrics);
    wlLogLevel = new Label(gDetails, SWT.RIGHT);
    wlLogLevel.setText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.LogLevel.Label"));
    wlLogLevel.setToolTipText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.LogLevel.Tooltip"));
    props.setLook(wlLogLevel);
    FormData fdlLogLevel = new FormData();
    fdlLogLevel.top = new FormAttachment(0, 10);
    fdlLogLevel.left = new FormAttachment(45, 0);
    wlLogLevel.setLayoutData(fdlLogLevel);
    wLogLevel = new CCombo(gDetails, SWT.READ_ONLY | SWT.BORDER);
    wLogLevel.setToolTipText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.LogLevel.Tooltip"));
    props.setLook(wLogLevel);
    FormData fdLogLevel = new FormData();
    fdLogLevel.top = new FormAttachment(wlLogLevel, -2, SWT.TOP);
    fdLogLevel.width = 180;
    fdLogLevel.left = new FormAttachment(wlLogLevel, 6);
    wLogLevel.setLayoutData(fdLogLevel);
    wLogLevel.setItems(LogLevel.getLogLevelDescriptions());
    Label lblStartJob = new Label(gDetails, SWT.RIGHT);
    lblStartJob.setText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.StartCopy.Label"));
    lblStartJob.setToolTipText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.StartCopy.Tooltip"));
    props.setLook(lblStartJob);
    FormData fd_lblStartJob = new FormData();
    fd_lblStartJob.top = new FormAttachment(wlLogLevel, 18);
    fd_lblStartJob.right = new FormAttachment(wlLogLevel, 0, SWT.RIGHT);
    lblStartJob.setLayoutData(fd_lblStartJob);
    wStartCopy = new CCombo(gDetails, SWT.READ_ONLY | SWT.BORDER);
    wStartCopy.setToolTipText(BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.StartCopy.Tooltip"));
    props.setLook(wStartCopy);
    FormData fd_startJobCombo = new FormData();
    fd_startJobCombo.top = new FormAttachment(lblStartJob, -2, SWT.TOP);
    fd_startJobCombo.width = 180;
    fd_startJobCombo.left = new FormAttachment(lblStartJob, 6);
    wStartCopy.setLayoutData(fd_startJobCombo);
    JobMeta jobMeta = (JobMeta) super.abstractMeta;
    String[] names = new String[jobMeta.getJobCopies().size()];
    for (int i = 0; i < names.length; i++) {
        JobEntryCopy copy = jobMeta.getJobCopies().get(i);
        names[i] = getJobEntryCopyName(copy);
    }
    wStartCopy.setItems(names);
}
Also used : FormData(org.eclipse.swt.layout.FormData) JobMeta(org.pentaho.di.job.JobMeta) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) CCombo(org.eclipse.swt.custom.CCombo) Button(org.eclipse.swt.widgets.Button) Label(org.eclipse.swt.widgets.Label) FormAttachment(org.eclipse.swt.layout.FormAttachment) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 44 with JobEntryCopy

use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.

the class TransAction method setPosition.

public void setPosition(Object[] obj, int[] idx, Point[] prev, Point[] curr) {
    if (prev.length != curr.length) {
        return;
    }
    previous_location = new Point[prev.length];
    current_location = new Point[curr.length];
    current = obj;
    current_index = idx;
    for (int i = 0; i < prev.length; i++) {
        previous_location[i] = new Point(prev[i].x, prev[i].y);
        current_location[i] = new Point(curr[i].x, curr[i].y);
    }
    Object fobj = obj[0];
    if (fobj instanceof StepMeta) {
        type = TYPE_ACTION_POSITION_STEP;
    }
    if (fobj instanceof NotePadMeta) {
        type = TYPE_ACTION_POSITION_NOTE;
    }
    if (fobj instanceof JobEntryCopy) {
        type = TYPE_ACTION_POSITION_JOB_ENTRY;
    }
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) Point(org.pentaho.di.core.gui.Point) NotePadMeta(org.pentaho.di.core.NotePadMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) Point(org.pentaho.di.core.gui.Point)

Example 45 with JobEntryCopy

use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.

the class Job method execute.

/**
 * Execute a job without previous results. This is a job entry point (not recursive)<br>
 * <br>
 *
 * @return the result of the execution
 *
 * @throws KettleException
 */
private Result execute() throws KettleException {
    try {
        log.snap(Metrics.METRIC_JOB_START);
        finished.set(false);
        stopped.set(false);
        KettleEnvironment.setExecutionInformation(this, rep);
        log.logMinimal(BaseMessages.getString(PKG, "Job.Comment.JobStarted"));
        ExtensionPointHandler.callExtensionPoint(log, KettleExtensionPoint.JobStart.id, this);
        // Start the tracking...
        JobEntryResult jerStart = new JobEntryResult(null, null, BaseMessages.getString(PKG, "Job.Comment.JobStarted"), BaseMessages.getString(PKG, "Job.Reason.Started"), null, 0, null);
        jobTracker.addJobTracker(new JobTracker(jobMeta, jerStart));
        active.set(true);
        // Where do we start?
        JobEntryCopy startpoint;
        // synchronize this to a parent job if needed.
        // 
        Object syncObject = this;
        if (parentJob != null) {
            // parallel execution in a job
            syncObject = parentJob;
        }
        synchronized (syncObject) {
            beginProcessing();
        }
        Result res = null;
        if (startJobEntryCopy == null) {
            startpoint = jobMeta.findJobEntry(JobMeta.STRING_SPECIAL_START, 0, false);
        } else {
            startpoint = startJobEntryCopy;
            res = startJobEntryResult;
        }
        if (startpoint == null) {
            throw new KettleJobException(BaseMessages.getString(PKG, "Job.Log.CounldNotFindStartingPoint"));
        }
        JobEntryResult jerEnd = null;
        if (startpoint.isStart()) {
            // Perform optional looping in the special Start job entry...
            // 
            // long iteration = 0;
            boolean isFirst = true;
            JobEntrySpecial jes = (JobEntrySpecial) startpoint.getEntry();
            while ((jes.isRepeat() || isFirst) && !isStopped()) {
                isFirst = false;
                res = execute(0, null, startpoint, null, BaseMessages.getString(PKG, "Job.Reason.Started"));
            // 
            // if (iteration > 0 && (iteration % 500) == 0) {
            // System.out.println("other 500 iterations: " + iteration);
            // }
            // iteration++;
            // 
            }
            jerEnd = new JobEntryResult(res, jes.getLogChannelId(), BaseMessages.getString(PKG, "Job.Comment.JobFinished"), BaseMessages.getString(PKG, "Job.Reason.Finished"), null, 0, null);
        } else {
            res = execute(0, res, startpoint, null, BaseMessages.getString(PKG, "Job.Reason.Started"));
            jerEnd = new JobEntryResult(res, startpoint.getEntry().getLogChannel().getLogChannelId(), BaseMessages.getString(PKG, "Job.Comment.JobFinished"), BaseMessages.getString(PKG, "Job.Reason.Finished"), null, 0, null);
        }
        // Save this result...
        jobTracker.addJobTracker(new JobTracker(jobMeta, jerEnd));
        log.logMinimal(BaseMessages.getString(PKG, "Job.Comment.JobFinished"));
        active.set(false);
        finished.set(true);
        return res;
    } finally {
        log.snap(Metrics.METRIC_JOB_STOP);
    }
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntrySpecial(org.pentaho.di.job.entries.special.JobEntrySpecial) JobTracker(org.pentaho.di.core.gui.JobTracker) FileObject(org.apache.commons.vfs2.FileObject) KettleJobException(org.pentaho.di.core.exception.KettleJobException) WebResult(org.pentaho.di.www.WebResult) Result(org.pentaho.di.core.Result)

Aggregations

JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)149 Point (org.pentaho.di.core.gui.Point)54 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)51 JobMeta (org.pentaho.di.job.JobMeta)47 KettleException (org.pentaho.di.core.exception.KettleException)30 Test (org.junit.Test)28 JobEntryInterface (org.pentaho.di.job.entry.JobEntryInterface)28 NotePadMeta (org.pentaho.di.core.NotePadMeta)24 JobHopMeta (org.pentaho.di.job.JobHopMeta)24 ArrayList (java.util.ArrayList)18 Job (org.pentaho.di.job.Job)18 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)16 JobEntryTrans (org.pentaho.di.job.entries.trans.JobEntryTrans)15 MessageBox (org.eclipse.swt.widgets.MessageBox)13 PluginInterface (org.pentaho.di.core.plugins.PluginInterface)10 Result (org.pentaho.di.core.Result)8 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)8 AreaOwner (org.pentaho.di.core.gui.AreaOwner)8 JobEntrySpecial (org.pentaho.di.job.entries.special.JobEntrySpecial)8 Before (org.junit.Before)7