Ejemplo n.º 1
0
        public JobLog CreateFailedJobLog(JobName jobName, DateTime beginTime, DateTime endTime)
        {
            JobLog _jobLog = new JobLog();

            _jobLog.JobClass = this.GetMESJobClass();            //JobClass.MES.ToString();	//JobClass应该从配置文件中获取

            _jobLog.Resultcode = 1;
            _jobLog.Resultdesc = "Failed";
            _jobLog.StartTime  = beginTime;
            _jobLog.EndTime    = endTime;

            if (jobName == JobName.MO)
            {
                _jobLog.JobName = JobName.MO.ToString();
            }
            else if (jobName == JobName.BOM)
            {
                _jobLog.JobName = JobName.BOM.ToString();
            }
            else if (jobName == JobName.MOBom)
            {
                _jobLog.JobName = JobName.MOBom.ToString();
            }

            return(_jobLog);
        }
        public void UpdateApplication()
        {
            moq::Mock <ApplicationService.ApplicationServiceClient> mockGrpcClient = new moq::Mock <ApplicationService.ApplicationServiceClient>(moq::MockBehavior.Strict);
            UpdateApplicationRequest request = new UpdateApplicationRequest
            {
                Application = new Application(),
            };
            Application expectedResponse = new Application
            {
                ApplicationName      = ApplicationName.FromProjectTenantProfileApplication("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]"),
                Profile              = "profile1b48977d",
                JobAsJobName         = JobName.FromProjectTenantJob("[PROJECT]", "[TENANT]", "[JOB]"),
                CompanyAsCompanyName = CompanyName.FromProjectTenantCompany("[PROJECT]", "[TENANT]", "[COMPANY]"),
                ApplicationDate      = new gt::Date(),
                Stage           = Application.Types.ApplicationStage.OfferAccepted,
                State           = Application.Types.ApplicationState.Unspecified,
                Interviews      = { new Interview(), },
                Referral        = false,
                CreateTime      = new wkt::Timestamp(),
                UpdateTime      = new wkt::Timestamp(),
                OutcomeNotes    = "outcome_notes38ed921d",
                Outcome         = Outcome.Neutral,
                IsMatch         = false,
                JobTitleSnippet = "job_title_snippet4f14afe7",
                ExternalId      = "external_id9442680e",
            };

            mockGrpcClient.Setup(x => x.UpdateApplication(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ApplicationServiceClient client = new ApplicationServiceClientImpl(mockGrpcClient.Object, null);
            Application response            = client.UpdateApplication(request.Application);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetJobAsync()
        {
            Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict);
            GetJobRequest expectedRequest = new GetJobRequest
            {
                JobName = new JobName("[PROJECT]", "[JOBS]"),
            };
            Job expectedResponse = new Job
            {
                JobName            = new JobName("[PROJECT]", "[JOBS]"),
                CompanyName        = "companyName1429880077",
                RequisitionId      = "requisitionId980224926",
                Title              = "title110371416",
                Description        = "description-1724546052",
                Department         = "department848184146",
                Incentives         = "incentives-1262874520",
                LanguageCode       = "languageCode-412800396",
                PromotionValue     = 353413845,
                Qualifications     = "qualifications1903501412",
                Responsibilities   = "responsibilities-926952660",
                CompanyDisplayName = "companyDisplayName1982424170",
            };

            mockGrpcClient.Setup(x => x.GetJobAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Job>(Task.FromResult(expectedResponse), null, null, null, null));
            JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null);
            JobName          name   = new JobName("[PROJECT]", "[JOBS]");
            Job response            = await client.GetJobAsync(name);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 4
0
        public void GetJob()
        {
            Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict);
            GetJobRequest expectedRequest = new GetJobRequest
            {
                Name = new JobName("[PROJECT]", "[JOB]").ToString(),
            };
            Job expectedResponse = new Job
            {
                Name               = "name2-1052831874",
                CompanyName        = "companyName1429880077",
                RequisitionId      = "requisitionId980224926",
                Title              = "title110371416",
                Description        = "description-1724546052",
                Department         = "department848184146",
                Incentives         = "incentives-1262874520",
                LanguageCode       = "languageCode-412800396",
                PromotionValue     = 353413845,
                Qualifications     = "qualifications1903501412",
                Responsibilities   = "responsibilities-926952660",
                CompanyDisplayName = "companyDisplayName1982424170",
            };

            mockGrpcClient.Setup(x => x.GetJob(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            JobServiceClient client        = new JobServiceClientImpl(mockGrpcClient.Object, null);
            string           formattedName = new JobName("[PROJECT]", "[JOB]").ToString();
            Job response = client.GetJob(formattedName);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Job.Length != 0)
            {
                hash ^= Job.GetHashCode();
            }
            if (JobName.Length != 0)
            {
                hash ^= JobName.GetHashCode();
            }
            if (JobDescriptions.Length != 0)
            {
                hash ^= JobDescriptions.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        // [START job_search_get_job_beta]
        public static object GetJob(string projectId, string tenantId, string jobId)
        {
            JobServiceClient jobServiceClient = JobServiceClient.Create();
            JobName          jobName          = JobName.FromProjectTenantJob(projectId, tenantId, jobId);
            GetJobRequest    request          = new GetJobRequest
            {
                JobName = jobName
            };
            var response = jobServiceClient.GetJob(request);

            Console.WriteLine($"Job name: {response.Name}");
            Console.WriteLine($"Requisition ID: {response.RequisitionId}");
            Console.WriteLine($"Title: {response.Title}");
            Console.WriteLine($"Description: {response.Description}");
            Console.WriteLine($"Posting language: {response.LanguageCode}");
            foreach (string address in response.Addresses)
            {
                Console.WriteLine($"Address: {address}");
            }
            foreach (string email in response.ApplicationInfo.Emails)
            {
                Console.WriteLine($"Email: {email}");
            }
            foreach (string websiteUri in response.ApplicationInfo.Uris)
            {
                Console.WriteLine($"Website: {websiteUri}");
            }
            return(0);
        }
Ejemplo n.º 7
0
        public ActionResult JobImplement(string jobNameList)
        {
            if (string.IsNullOrEmpty(jobNameList))
            {
                return(ErrorNotification("请选择至少一个待执行的JOB!"));
            }

            string[] nameList = jobNameList.Split(',');

            if (nameList.Length == 0)
            {
                return(ErrorNotification("没有提供正确的JOB处理信息"));
            }

            List <JobName> nameEnum = new List <JobName>();

            foreach (string item in nameList)
            {
                if (string.IsNullOrEmpty(item))
                {
                    continue;
                }
                JobName jobType = (JobName)Enum.Parse(typeof(JobName), item);
                nameEnum.Add(jobType);
            }

            _manualStartJobService.ManualStartJob(nameEnum);

            return(SuccessNotification("操作执行完毕!"));
        }
Ejemplo n.º 8
0
        public ActionResult JobImplement(string jobNameList)
        {
            if (string.IsNullOrEmpty(jobNameList))
            {
                return(Json(new { status = "99", message = "请选择至少一个待执行的JOB!" }, JsonRequestBehavior.AllowGet));
            }

            string[] nameList = jobNameList.Split(',');

            if (nameList.Length == 0)
            {
                return(Json(new { status = 99, message = "没有提供正确的JOB处理信息" }, JsonRequestBehavior.AllowGet));
            }

            var nameEnum = new List <JobName>();

            foreach (string item in nameList)
            {
                if (string.IsNullOrEmpty(item))
                {
                    continue;
                }
                JobName jobType = (JobName)Enum.Parse(typeof(JobName), item);
                nameEnum.Add(jobType);
            }

            _manualStartJobService.ManualStartJob(nameEnum);
            return(Json(new { status = 200 }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (cluster_ != null)
            {
                hash ^= Cluster.GetHashCode();
            }
            if (JobName.Length != 0)
            {
                hash ^= JobName.GetHashCode();
            }
            if (TaskIndex != 0)
            {
                hash ^= TaskIndex.GetHashCode();
            }
            if (defaultSessionConfig_ != null)
            {
                hash ^= DefaultSessionConfig.GetHashCode();
            }
            if (Protocol.Length != 0)
            {
                hash ^= Protocol.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Look for all jobs that match a certian criteria.
        /// </summary>
        protected override void ProcessRecord()
        {
            Func <AtlasJob, bool> nameSelector    = _ => true;
            Func <AtlasJob, bool> versionSelector = _ => true;

            if (!string.IsNullOrWhiteSpace(JobName))
            {
                var matcher = new Regex(JobName.Replace("*", ".*"));
                nameSelector = j => matcher.Match(j.Name).Success;
            }

            if (!string.IsNullOrWhiteSpace(JobVersion))
            {
                int version = 0;
                if (!int.TryParse(JobVersion, out version))
                {
                    throw new ArgumentException(string.Format("JobVersion must be a valid integer, not '{0}'", JobVersion));
                }

                versionSelector = j => j.Version == version;
            }

            // Now we can actually go through and get all the jobs.

            var jobs = JobParser.FindJobs(j => nameSelector(j) && versionSelector(j));

            // And return what we found out.
            foreach (var j in jobs.Select(fullSpec => new AtlasJobSpec()
            {
                JobName = fullSpec.Name, JobVersion = fullSpec.Version
            }))
            {
                WriteObject(j);
            }
        }
Ejemplo n.º 11
0
 public void Rename(JobName newName)
 {
     if (_state.Status == JobStatus.InActive)
     {
         throw new InvalidOperationException("Job is inactive");
     }
     RaiseEvent(new JobRenamed(Id, newName, _state.Name));
 }
 /// <summary>Snippet for GetJob</summary>
 public void GetJob()
 {
     // Snippet: GetJob(JobName,CallSettings)
     // Create client
     JobServiceClient jobServiceClient = JobServiceClient.Create();
     // Initialize request argument(s)
     JobName name = new JobName("[PROJECT]", "[JOBS]");
     // Make the request
     Job response = jobServiceClient.GetJob(name);
     // End snippet
 }
Ejemplo n.º 13
0
 /// <summary>Snippet for GetJob</summary>
 public void GetJob()
 {
     // Snippet: GetJob(string,CallSettings)
     // Create client
     JobServiceClient jobServiceClient = JobServiceClient.Create();
     // Initialize request argument(s)
     string formattedName = new JobName("[PROJECT]", "[JOB]").ToString();
     // Make the request
     Job response = jobServiceClient.GetJob(formattedName);
     // End snippet
 }
Ejemplo n.º 14
0
 /// <summary>Snippet for ResumeJob</summary>
 public void ResumeJob()
 {
     // Snippet: ResumeJob(string,CallSettings)
     // Create client
     CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.Create();
     // Initialize request argument(s)
     string formattedName = new JobName("[PROJECT]", "[LOCATION]", "[JOB]").ToString();
     // Make the request
     Job response = cloudSchedulerClient.ResumeJob(formattedName);
     // End snippet
 }
 /// <summary>Snippet for ResumeJob</summary>
 public void ResumeJobResourceNames()
 {
     // Snippet: ResumeJob(JobName, CallSettings)
     // Create client
     CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.Create();
     // Initialize request argument(s)
     JobName name = JobName.FromProjectLocationJob("[PROJECT]", "[LOCATION]", "[JOB]");
     // Make the request
     Job response = cloudSchedulerClient.ResumeJob(name);
     // End snippet
 }
Ejemplo n.º 16
0
 /// <summary>Snippet for RunJob</summary>
 public void RunJob()
 {
     // Snippet: RunJob(JobName,CallSettings)
     // Create client
     CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.Create();
     // Initialize request argument(s)
     JobName name = new JobName("[PROJECT]", "[LOCATION]", "[JOB]");
     // Make the request
     Job response = cloudSchedulerClient.RunJob(name);
     // End snippet
 }
    public void DeleteJob(string projectId, string location, string jobId)
    {
        // Create the client.
        TranscoderServiceClient client = TranscoderServiceClient.Create();

        // Build the job name.
        JobName jobName = JobName.FromProjectLocationJob(projectId, location, jobId);

        // Call the API.
        client.DeleteJob(jobName);
    }
Ejemplo n.º 18
0
        /// <summary>Snippet for DeleteJob</summary>
        public void DeleteJob_ResourceNames()
        {
            // Snippet: DeleteJob(JobName, CallSettings)
            // Create client
            CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.Create();
            // Initialize request argument(s)
            JobName name = new JobName("[PROJECT]", "[LOCATION]", "[JOB]");

            // Make the request
            cloudSchedulerClient.DeleteJob(name);
            // End snippet
        }
        // [START job_search_create_client_event]
        public static object CreateClientEvent(string projectId, string tenantId, string requestId, string eventId, IEnumerable <string> jobIds)
        {
            EventServiceClient eventServiceClient = EventServiceClient.Create();

            TenantName tenantName = TenantName.FromProjectTenant(projectId, tenantId);

            long      seconds    = 1L;
            Timestamp createTime = new Timestamp
            {
                Seconds = seconds
            };

            // The type of event attributed to the behavior of the end user.
            JobEventType type = JobEventType.View;

            // List of job names associated with this event.
            List <string> jobs = new List <string>();

            foreach (var jobId in jobIds)
            {
                //build full path of job IDs
                JobName name = JobName.FromProjectTenantJob(projectId, tenantId, jobId);
                jobs.Add(name.ToString());
            }

            JobEvent jobEvent = new JobEvent
            {
                Type = type
            };

            jobEvent.Jobs.Add(jobs);

            ClientEvent clientEvent = new ClientEvent
            {
                RequestId  = requestId,
                EventId    = eventId,
                CreateTime = createTime,
                JobEvent   = jobEvent
            };

            CreateClientEventRequest request = new CreateClientEventRequest
            {
                ParentAsTenantName = tenantName,
                ClientEvent        = clientEvent
            };

            ClientEvent response = eventServiceClient.CreateClientEvent(request);

            Console.WriteLine($"Created client event.");
            Console.WriteLine(response);

            return(0);
        }
Ejemplo n.º 20
0
        private string GetLastupdateCondition(JobName jobName)
        {
            string lastUpdateCondition = string.Empty;

            object[] logs = this.GetJobLog(jobName);
            if (logs != null && logs.Length > 0)
            {
                lastUpdateCondition = " AND LASTUPDATE > to_date('{0}','YYYY-MM-DD HH24:MI:SS') ";
                JobLog lastJobLog = (JobLog)logs[0];
                lastUpdateCondition = string.Format(lastUpdateCondition, lastJobLog.EndTime.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            return(lastUpdateCondition);
        }
Ejemplo n.º 21
0
        public void MergeDotCoverSnapshots()
        {
            var DotCoverSnapshots = Directory.GetFiles(MergeDotCoverSnapshotsInDirectory, "*.dcvr", SearchOption.AllDirectories).ToList();

            if (string.IsNullOrEmpty(JobName))
            {
                JobName = "DotCover";
            }
            var MergedSnapshotFileName = JobName.Split(',')[0];

            MergedSnapshotFileName = "Merged " + MergedSnapshotFileName + " Snapshots";
            TestCoverageMerger.MergeCoverageSnapshots(DotCoverSnapshots, MergeDotCoverSnapshotsInDirectory + "\\" + MergedSnapshotFileName, MergeDotCoverSnapshotsInDirectory + "\\DotCover", DotCoverPath);
        }
Ejemplo n.º 22
0
            public override int GetHashCode()
            {
                unchecked
                {
                    int hashCode = 0;
                    hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
                    hashCode = (hashCode * 397) ^ (Group != null ? Group.GetHashCode() : 0);
                    hashCode = (hashCode * 397) ^ (JobName != null ? JobName.GetHashCode() : 0);
                    hashCode = (hashCode * 397) ^ (Identity != null ? Identity.GetHashCode() : 0);
                    hashCode = (hashCode * 397) ^ (Cron != null ? Cron.GetHashCode() : 0);

                    return(hashCode);
                }
            }
        /// <summary>Snippet for DeleteJobAsync</summary>
        public async Task DeleteJobAsync()
        {
            // Snippet: DeleteJobAsync(JobName,CallSettings)
            // Additional: DeleteJobAsync(JobName,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            JobName name = new JobName("[PROJECT]", "[JOBS]");
            // Make the request
            await jobServiceClient.DeleteJobAsync(name);

            // End snippet
        }
Ejemplo n.º 24
0
        /// <summary>Snippet for RunJobAsync</summary>
        public async Task RunJobAsync()
        {
            // Snippet: RunJobAsync(JobName,CallSettings)
            // Additional: RunJobAsync(JobName,CancellationToken)
            // Create client
            CloudSchedulerClient cloudSchedulerClient = await CloudSchedulerClient.CreateAsync();

            // Initialize request argument(s)
            JobName name = new JobName("[PROJECT]", "[LOCATION]", "[JOB]");
            // Make the request
            Job response = await cloudSchedulerClient.RunJobAsync(name);

            // End snippet
        }
    public Job.Types.ProcessingState GetJobState(string projectId, string location, string jobId)
    {
        // Create the client.
        TranscoderServiceClient client = TranscoderServiceClient.Create();

        // Build the job name.
        JobName jobName = JobName.FromProjectLocationJob(projectId, location, jobId);

        // Call the API.
        Job job = client.GetJob(jobName);

        // Return the result.
        return(job.State);
    }
 /// <summary>Snippet for RunJob</summary>
 public void RunJobRequestObject()
 {
     // Snippet: RunJob(RunJobRequest, CallSettings)
     // Create client
     CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.Create();
     // Initialize request argument(s)
     RunJobRequest request = new RunJobRequest
     {
         JobName = JobName.FromProjectLocationJob("[PROJECT]", "[LOCATION]", "[JOB]"),
     };
     // Make the request
     Job response = cloudSchedulerClient.RunJob(request);
     // End snippet
 }
        /// <summary>Snippet for PauseJobAsync</summary>
        public async Task PauseJobResourceNamesAsync()
        {
            // Snippet: PauseJobAsync(JobName, CallSettings)
            // Additional: PauseJobAsync(JobName, CancellationToken)
            // Create client
            CloudSchedulerClient cloudSchedulerClient = await CloudSchedulerClient.CreateAsync();

            // Initialize request argument(s)
            JobName name = JobName.FromProjectLocationJob("[PROJECT]", "[LOCATION]", "[JOB]");
            // Make the request
            Job response = await cloudSchedulerClient.PauseJobAsync(name);

            // End snippet
        }
        // [START job_search_delete_job_beta]
        public static object DeleteJob(string projectId, string tenantId, string jobId)
        {
            JobServiceClient jobServiceClient = JobServiceClient.Create();
            JobName          name             = new JobName(projectId, tenantId, jobId);
            DeleteJobRequest request          = new DeleteJobRequest
            {
                JobNameOneof = JobNameOneof.From(name)
            };

            jobServiceClient.DeleteJob(request);

            Console.WriteLine("Deleted Job.");
            return(0);
        }
Ejemplo n.º 29
0
        /// <summary>Snippet for ResumeJobAsync</summary>
        public async Task ResumeJobAsync()
        {
            // Snippet: ResumeJobAsync(string,CallSettings)
            // Additional: ResumeJobAsync(string,CancellationToken)
            // Create client
            CloudSchedulerClient cloudSchedulerClient = await CloudSchedulerClient.CreateAsync();

            // Initialize request argument(s)
            string formattedName = new JobName("[PROJECT]", "[LOCATION]", "[JOB]").ToString();
            // Make the request
            Job response = await cloudSchedulerClient.ResumeJobAsync(formattedName);

            // End snippet
        }
Ejemplo n.º 30
0
        public override XmlElement Export(XmlDocument doc, XmlElement parent)
        {
            XmlElement current = base.Export(doc, parent);

            if (JobName != null)
            {
                current.SetAttribute("JOBNAME", JobName.ToString());
            }
            if (ParentFolder != null)
            {
                current.SetAttribute("PARENT_FOLDER", ParentFolder.ToString());
            }
            return(current);
        }