Exemple #1
0
    static void RunAndDownload(SfbClient _net, string shortName, string directoryName, JobEntry je)
    {
        je.RunAndDownloadIsActive = true;
        string errortext = null;

        _net.Run(je.filetype, shortName, je, ref errortext);

        if (errortext == "Maximum number of concurrent jobs exceeded.")
        {
            _net.Disconnect();
            je.WriteToLog(errortext.ToLower());
            je.SetStatus(Status.schedulerequest);
        }
        else if (errortext != null)
        {
            _net.Disconnect();
            MessageBoxShow(je._houston, errortext, "Run error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        else
        {
            _net.GetFinalStatus();
            je.SetCpuAndMem();

            _net.Download(je.DirectoryName);
            //je.WriteToLog("downloading finished");
            _net.Disconnect();
            if (je.stat == Status.aborted)
            {
                je.WriteToLog("abort completed");
            }
        }
    }
Exemple #2
0
    public static void InvokedTimerTick(Object obj)
    {
        JobEntry je = (JobEntry)obj;

        try
        {
            if (je._job != null)
            {
                int id = je._job.Id; //Test if the process exists.
                je._job.Refresh();
                if (!je._job.HasExited)
                {
                    System.TimeSpan diff1 = DateTime.Now.Subtract(je._job.StartTime);
                    //je.SubItems[(int)Display.cpu].Text = diff1.TotalSeconds.ToString("#0.0")+"s";
                    je.SubItems[(int)Display.cpu].Text = je._job.TotalProcessorTime.TotalSeconds.ToString("#0.0") + "s";
                    je.SubItems[(int)Display.mem].Text = (1 + je._job.WorkingSet64 / 1024).ToString("n0") + "kb";
                }
            }
            else if (je._net != null)
            {
                je.SetCpuAndMem();
            }
        }
        catch //This might be a _net job
        {
            if (je._net != null)
            {
            }
        }

        if (je.stat == Status.scheduled && DateTime.Compare(DateTime.Now, je._schedTime) > 0)
        {
            je.SetStatus(Status.queued);
        }
        else if (je.stat == Status.rscheduled && DateTime.Compare(DateTime.Now, je._schedTime) > 0)
        {
            je.SetStatus(Status.rqueued);
        }
    }
Exemple #3
0
    public void Run(FileType what, string fname, JobEntry je, ref string errortext)
    {
        string image;

        lock (io)
        {
            io.locker++;
            switch (what)
            {
            case FileType.sfbox:
                io.WriteLine("RUN " + fname);
                break;

            case FileType.mcrenko:
                io.WriteLine("RUNMC " + fname);
                break;

            case FileType.mccompile:
                io.WriteLine("RUNMCCOMPILE " + fname);
                break;

            case FileType.ctb:
                io.WriteLine("RUNCTB " + fname);
                break;
            }
            image = io.ReadLine();
            if (image.Substring(0, 1) == "+")
            {
                //je.timer.Change(500,2000);
                image = io.ReadLine();
                while (true)
                {
                    if (image.Length >= 13 && image.Substring(0, 13) == "+OK  Finished")
                    {
                        break;
                    }
                    else if (image.Length == 12 && image.Substring(0, 12) == "+OK  Stopped")
                    {
                        je.SetStatus(Status.waiting);
                    }
                    else if (image.Length == 14 && image.Substring(0, 14) == "+OK  Continued")
                    {
                        je.SetStatus(Status.resumed);
                    }
                    else
                    {
                        //throw new DivideByZeroException("Invalid Division");
                        try {
                            je._theTabs.BeginInvoke(je.asyncReadCallback, new Object[] { image + "\r\n" });
                        }
                        catch (Exception e) {
                            errortext = e.Message;
                            break;
                        }
                    }
                    image = io.ReadLine();
                }
                //je.timer.Change(0,0);
            }
            else if (image.Length > 5)
            {
                errortext = image.Substring(5);
            }
            else
            {
                errortext = "Unknown error whilst running. \r\nUnknown RUN command?";
            }
        }
    }