Example #1
0
        public void PRJobAborting(IProcessJob job)
        {
            //FALoggerClass.Instance.WriteFile("PRJobAborting[PJCJCtrl]", LogType.DEBUG, "IProcessJob job = " + job.objID);
            FALoggerClass.Instance.WriteFile("10151", LogType.DEBUG, " " + job.objID);

            if (job.Substrates != null && job.PRMtlNameList[0].CarrierID != null && job.ControlJobID != null)
            {
                if (job.PRJobState != PRJobState.PAUSING && job.PRJobState != PRJobState.PAUSED && job.PRJobState != PRJobState.NO_STATE)
                {
                    if ((int)TunnelClass.Instance.GetEC((int)EC_AX.EC_CJAbortRMMod, 0) == 0)
                    {
                        DeleteWaferOrderList(job.Substrates, job.PRMtlNameList[0].CarrierID);
                    }
                    else
                    {
                        ReturnWaferOrderList(job.Substrates, job.PRMtlNameList[0].CarrierID, job.ControlJobID, job.objID);
                    }
                }
                if (job.Substrates.Length > 0)
                {
                    SetSubstrateState(job.Substrates, SubstProcState.ABORTED);
                }
                int portId = TunnelClass.Instance.GetPortIdInCarrier(job.PRMtlNameList[0].CarrierID);
                if (portId != -1)
                {
                    TunnelClass.Instance.isReadyToSetFOUPDone(portId, true);
                }
                job.PRJobDone();
            }
            else
            {
                //FALoggerClass.Instance.WriteFile("PRJobAborting[PJCJCtrl]", LogType.DEBUG, "job.Substrates == null or job.PRMtlNameList[0].CarrierID == null or job.ControlJobID == null");
                FALoggerClass.Instance.WriteFile("10152", LogType.DEBUG, " ");
            }
        }
Example #2
0
 public void PRJobResumed(IProcessJob job)
 {
     //FALoggerClass.Instance.WriteFile("PRJobResumed[PJCJCtrl]", LogType.DEBUG, "IProcessJob job = " + job.objID);
     FALoggerClass.Instance.WriteFile("10155", LogType.DEBUG, " " + job.objID);
     if (job.Substrates != null && job.PRMtlNameList[0].CarrierID != null)
     {
         InsertWaferOrderList(job.Substrates, job.PRMtlNameList[0].CarrierID);
     }
     else
     {
         FALoggerClass.Instance.WriteFile("10156", LogType.DEBUG, " ");
     }
     //FALoggerClass.Instance.WriteFile("PRJobResumed[PJCJCtrl]", LogType.DEBUG, "job.Substrates == null or job.PRMtlNameList[0].CarrierID == null");
     job.PRJobResumed();
 }
Example #3
0
 //private static ConxCalls conectLinkEDA;
 //private static FALoggerClass FALogPJCJCtrl = new FALoggerClass();
 public void PRJobStopping(IProcessJob job)
 {
     //FALoggerClass.Instance.WriteFile("PRJobStopping[PJCJCtrl]", LogType.DEBUG, "IProcessJob job = " + job.objID);
     FALoggerClass.Instance.WriteFile("10149", LogType.DEBUG, " " + job.objID);
     if (job.PRJobState != PRJobState.PAUSING && job.PRJobState != PRJobState.PAUSED && job.PRJobState != PRJobState.NO_STATE)
     {
         DeleteWaferOrderList(job.Substrates, job.PRMtlNameList[0].CarrierID);
     }
     if (job.Substrates != null && job.Substrates.Length > 0)
     {
         SetSubstrateState(job.Substrates, SubstProcState.STOPPED);
     }
     else
     {
         //FALoggerClass.Instance.WriteFile("PRJobStopping[PJCJCtrl]", LogType.DEBUG, "Ijob.Substrates == null or  job.Substrates.Length == 0");
         FALoggerClass.Instance.WriteFile("10150", LogType.DEBUG, " ");
     }
 }
Example #4
0
    /// <summary>
    /// Do the actual work in processing a task in the queue
    /// </summary>
    /// <param name="job"></param>
    /// <param name="cpuPercentage"></param>
    /// <returns></returns>
    private void ProcessJob(IProcessJob job, int cpuPercentage)
    {
        // If we can't process, we'll discard this job, and pick it
        // up again in future during the next GetPendingJobs call.
        if (job.CanProcess)
        {
            string jobName = job.GetType().Name;

            SetStatus($"{job.Name}", JobStatus.Running, cpuPercentage);

            Logging.LogVerbose($"Processing job type: {jobName}");

            Stopwatch stopwatch = new Stopwatch($"ProcessJob{jobName}");
            try
            {
                job.Process();
            }
            catch (Exception ex)
            {
                Logging.LogError($"Exception processing {job.Description}: {ex.Message}");
            }
            finally
            {
                stopwatch.Stop();
            }

            // Now, decide how much we need to sleep, in order to throttle CPU to the desired percentage
            // E.g., if the job took 2.5s to execute, then in order to maintain 25% CPU usage, we need to
            // sleep for 7.5s. Similarly, if the job took 0.5s, and we want to maintain 75% CPU usage,
            // we'd sleep for 0.33s.
            double sleepFactor = (1.0 / (cpuPercentage / 100.0)) - 1;

            if (sleepFactor > 0)
            {
                // Never ever sleep for more than 10s. Otherwise a long-running job that takes a minute
                // to complete could end up freezing the worker thread for 3 minutes, which makes no
                // sense whatsoeever. :)
                const int maxWaitTime = 10 * 1000;
                int       waitTime    = Math.Min((int)(sleepFactor * stopwatch.ElapsedTime), maxWaitTime);
                Logging.LogVerbose($"Job '{jobName}' took {stopwatch.ElapsedTime}ms, so sleeping {waitTime} to give {cpuPercentage}% CPU usage.");
                Thread.Sleep(waitTime);
            }
        }
    }
Example #5
0
 private void SetPRJobDone(IProcessJob job)
 {
 }