public void StepExecutionComplete(IJTXJob job, int stepId, IJTXExecuteInfo execInfo) { lock (m_queuedMessages) { m_queuedMessages.Add("Finished running step '" + stepId.ToString() + "' for job: " + job.ID.ToString()); } }
/// <summary> /// Required by IGPFunction2 interface; this function is called when the GP tool is ready to be executed. /// </summary> /// <param name="paramValues"></param> /// <param name="trackCancel"></param> /// <param name="envMgr"></param> /// <param name="msgs"></param> public override void Execute(IArray paramValues, ITrackCancel trackCancel, IGPEnvironmentManager envMgr, IGPMessages msgs) { // Do some common error-checking base.Execute(paramValues, trackCancel, envMgr, msgs); // Assign the requested job try { IJTXJobManager jobManager = this.WmxDatabase.JobManager; IJTXWorkflowExecution3 jobExec = jobManager.GetJob(m_jobId) as IJTXWorkflowExecution3; // Don't try to deal with the case of multiple active steps int[] currentStepIds = jobExec.GetCurrentSteps(); if (currentStepIds.Length != 1) { throw new WmauException(WmauErrorCodes.C_NO_OR_MULTIPLE_STEPS_ERROR); } jobExec.RunStepChecks(currentStepIds[0], true); IJTXExecuteInfo execInfo = jobExec.RunStep(currentStepIds[0], false, true, false, this); if (execInfo.ThrewError) { throw new WmauException( WmauErrorCodes.C_JOB_EXECUTION_ERROR, new Exception(execInfo.ErrorCode.ToString() + ": " + execInfo.ErrorDescription)); } // Set the output parameter WmauParameterMap paramMap = new WmauParameterMap(paramValues); IGPParameterEdit3 outParamEdit = paramMap.GetParamEdit(C_PARAM_OUT_JOB_ID); IGPLong outValue = new GPLongClass(); outValue.Value = m_jobId; outParamEdit.Value = outValue as IGPValue; msgs.AddMessage(Properties.Resources.MSG_DONE); } catch (WmauException wmEx) { try { msgs.AddError(wmEx.ErrorCodeAsInt, wmEx.Message); } catch { // Catch anything else that possibly happens } } catch (Exception ex) { WmauError error = new WmauError(WmauErrorCodes.C_UNSPECIFIED_ERROR); msgs.AddError(error.ErrorCodeAsInt, error.Message + "; " + ex.Message); } }