public virtual void TestStatusChange() { //Start the node node.Handle(new RMNodeStartedEvent(null, null, null)); //Add info to the queue first node.SetNextHeartBeat(false); ContainerId completedContainerId1 = BuilderUtils.NewContainerId(BuilderUtils.NewApplicationAttemptId (BuilderUtils.NewApplicationId(0, 0), 0), 0); ContainerId completedContainerId2 = BuilderUtils.NewContainerId(BuilderUtils.NewApplicationAttemptId (BuilderUtils.NewApplicationId(1, 1), 1), 1); RMNodeStatusEvent statusEvent1 = GetMockRMNodeStatusEvent(); RMNodeStatusEvent statusEvent2 = GetMockRMNodeStatusEvent(); ContainerStatus containerStatus1 = Org.Mockito.Mockito.Mock <ContainerStatus>(); ContainerStatus containerStatus2 = Org.Mockito.Mockito.Mock <ContainerStatus>(); Org.Mockito.Mockito.DoReturn(completedContainerId1).When(containerStatus1).GetContainerId (); Org.Mockito.Mockito.DoReturn(Sharpen.Collections.SingletonList(containerStatus1)) .When(statusEvent1).GetContainers(); Org.Mockito.Mockito.DoReturn(completedContainerId2).When(containerStatus2).GetContainerId (); Org.Mockito.Mockito.DoReturn(Sharpen.Collections.SingletonList(containerStatus2)) .When(statusEvent2).GetContainers(); Org.Mockito.Mockito.Verify(scheduler, Org.Mockito.Mockito.Times(1)).Handle(Matchers.Any <NodeUpdateSchedulerEvent>()); node.Handle(statusEvent1); node.Handle(statusEvent2); Org.Mockito.Mockito.Verify(scheduler, Org.Mockito.Mockito.Times(1)).Handle(Matchers.Any <NodeUpdateSchedulerEvent>()); NUnit.Framework.Assert.AreEqual(2, node.GetQueueSize()); node.Handle(new RMNodeEvent(node.GetNodeID(), RMNodeEventType.Expire)); NUnit.Framework.Assert.AreEqual(0, node.GetQueueSize()); }
public async Task <IActionResult> UploadPreprocessImage([FromRoute] long id, [FromRoute] long dataId, [FromBody] AddOutputDataInputModel model) { if (!ModelState.IsValid) { return(JsonBadRequest("Invalid inputs.")); } // データの存在チェック var preprocessHistory = await preprocessHistoryRepository.GetPreprocessIncludeDataAndPreprocessAsync(id, dataId); if (preprocessHistory == null) { return(JsonNotFound($"Preprocessing History about Preprocess {id} to Data {dataId} is not found.")); } var status = ContainerStatus.Convert(preprocessHistory.Status); if (status.IsOpened() == false) { // 追加できるのは開放中のコンテナだけ(ローカルの結果を追加することがあるので、Runningとは限らない) return(JsonBadRequest($"Preprocessing History {preprocessHistory.Id} is not opened.")); } // データを追加する Data newData = new Data() { // データ名が未指定であれば、デフォルトの値を入れる Name = string.IsNullOrEmpty(model.Name) ? $"{preprocessHistory.InputData.Name}_{preprocessHistory.Preprocess.Name}" : model.Name, Memo = model.Memo, ParentDataId = preprocessHistory.InputDataId }; dataRepository.Add(newData); foreach (var file in model.Files) { dataRepository.AddFile(newData, file.FileName, file.StoredPath); } // タグの登録 if (model.Tags != null && model.Tags.Count() > 0) { tagLogic.CreateDataTags(newData, model.Tags); } else { // タグが未指定であれば、前処理名を付ける List <string> tags = new List <string>() { preprocessHistory.Preprocess.Name }; tagLogic.CreateDataTags(newData, tags); } preprocessHistoryRepository.AddOutputData(preprocessHistory.Id, newData); unitOfWork.Commit(); return(JsonOK(new HistoriesOutputModel(preprocessHistory))); }
public async Task <ActionResult <ContainerStatus> > PostContainerStatus(ContainerStatus containerStatus) { _context.ContainerStatus.Add(containerStatus); await _context.SaveChangesAsync(); return(CreatedAtAction("GetContainerStatus", new { id = containerStatus.ContainerStatusId }, containerStatus)); }
/// <exception cref="System.IO.IOException"/> public virtual StartContainersResponse StartContainers(StartContainersRequest requests ) { StartContainerRequest request = requests.GetStartContainerRequests()[0]; ContainerTokenIdentifier containerTokenIdentifier = MRApp.NewContainerTokenIdentifier (request.GetContainerToken()); // Validate that the container is what RM is giving. NUnit.Framework.Assert.AreEqual(MRApp.NmHost + ":" + MRApp.NmPort, containerTokenIdentifier .GetNmHostAddress()); StartContainersResponse response = TestContainerLauncher.recordFactory.NewRecordInstance <StartContainersResponse>(); this.status = TestContainerLauncher.recordFactory.NewRecordInstance<ContainerStatus >(); try { // make the thread sleep to look like its not going to respond Sharpen.Thread.Sleep(15000); } catch (Exception e) { TestContainerLauncher.Log.Error(e); throw new UndeclaredThrowableException(e); } this.status.SetState(ContainerState.Running); this.status.SetContainerId(containerTokenIdentifier.GetContainerID()); this.status.SetExitStatus(0); return response; }
/// <summary> /// 前処理実行を終了させる。 /// </summary> /// <param name="id">前処理ID</param> /// <param name="dataId">入力データID</param> /// <param name="newStatus">変更後のステータス</param> private async Task <IActionResult> ExitAsync(long id, long dataId, ContainerStatus newStatus) { // データの存在チェック var preprocessHistory = await preprocessHistoryRepository.GetPreprocessIncludeDataAndPreprocessAsync(id, dataId); if (preprocessHistory == null) { return(JsonNotFound($"Preprocessing History about Preprocess {id} to Data {dataId} is not found.")); } var status = ContainerStatus.Convert(preprocessHistory.Status); if (status.IsOpened() == false) { // 終了できるのは開放中のコンテナだけ(ローカルの結果を追加することがあるので、Runningとは限らない) return(JsonBadRequest($"Preprocessing History {preprocessHistory.Id} is not opened.")); } if (status.Exist()) { // コンテナが動いていれば、停止する await clusterManagementLogic.DeleteContainerAsync( ContainerType.Preprocessing, preprocessHistory.Name, CurrentUserInfo.SelectedTenant.Name, false); } preprocessHistory.CompletedAt = DateTime.Now; preprocessHistory.Status = newStatus.Key; unitOfWork.Commit(); return(JsonOK(new HistoriesOutputModel(preprocessHistory))); }
public TensorBoardOutputModel(TensorBoardContainer container, ContainerStatus status, string endpoint = null) { Status = status.Name; StatusType = status.StatusType; if (container != null) { Name = container.Name; if (status.Exist() && string.IsNullOrEmpty(container.Host) == false) { //ノードポート番号を返す NodePort = container.PortNo.ToString(); } // 残り生存時間を計算する if (container.ExpiresIn.HasValue && container.ExpiresIn.Value != 0) { long elapsedTicks = container.StartedAt.AddSeconds(container.ExpiresIn.Value).Ticks - DateTime.Now.Ticks; TimeSpan elapsedSpan = new TimeSpan(elapsedTicks); if (elapsedSpan.Ticks < 0) { RemainingTime = "0d 0h 0m"; } else { RemainingTime = elapsedSpan.ToString(@"%d'd '%h'h '%m'm'", CultureInfo.InvariantCulture); } } else { // 生存時間が無期限の場合はnullを返す RemainingTime = null; } } }
/// <exception cref="System.Exception"/> /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> /// <exception cref="System.IO.IOException"/> public static void WaitForContainerState(ContainerManagementProtocol containerManager , ContainerId containerID, ContainerState finalState, int timeOutMax) { IList <ContainerId> list = new AList <ContainerId>(); list.AddItem(containerID); GetContainerStatusesRequest request = GetContainerStatusesRequest.NewInstance(list ); ContainerStatus containerStatus = containerManager.GetContainerStatuses(request). GetContainerStatuses()[0]; int timeoutSecs = 0; while (!containerStatus.GetState().Equals(finalState) && timeoutSecs++ < timeOutMax ) { Sharpen.Thread.Sleep(1000); Log.Info("Waiting for container to get into state " + finalState + ". Current state is " + containerStatus.GetState()); containerStatus = containerManager.GetContainerStatuses(request).GetContainerStatuses ()[0]; } Log.Info("Container state is " + containerStatus.GetState()); NUnit.Framework.Assert.AreEqual("ContainerState is not correct (timedout)", finalState , containerStatus.GetState()); }
public virtual void TestNMSentContainerStatusOnResync() { ContainerStatus testCompleteContainer = TestNodeStatusUpdater.CreateContainerStatus (2, ContainerState.Complete); Org.Apache.Hadoop.Yarn.Server.Nodemanager.Containermanager.Container.Container container = TestNodeStatusUpdater.GetMockContainer(testCompleteContainer); NMContainerStatus report = CreateNMContainerStatus(2, ContainerState.Complete); Org.Mockito.Mockito.When(container.GetNMContainerStatus()).ThenReturn(report); NodeManager nm = new _NodeManager_225(this, testCompleteContainer, container); // first register, no containers info. // put the completed container into the context // second register contains the completed container info. // first heartBeat contains the completed container info // notify RESYNC on first heartbeat. YarnConfiguration conf = CreateNMConfig(); nm.Init(conf); nm.Start(); try { syncBarrier.Await(); } catch (BrokenBarrierException) { } NUnit.Framework.Assert.IsFalse(assertionFailedInThread.Get()); nm.Stop(); }
protected internal override void CompletedContainer(RMContainer rmContainer, ContainerStatus containerStatus, RMContainerEventType @event) { lock (this) { if (rmContainer == null) { Log.Info("Null container completed..."); return; } // Get the application for the finished container Container container = rmContainer.GetContainer(); FiCaSchedulerApp application = GetCurrentAttemptForContainer(container.GetId()); ApplicationId appId = container.GetId().GetApplicationAttemptId().GetApplicationId (); // Get the node on which the container was allocated FiCaSchedulerNode node = GetNode(container.GetNodeId()); if (application == null) { Log.Info("Unknown application: " + appId + " released container " + container.GetId () + " on node: " + node + " with event: " + @event); return; } // Inform the application application.ContainerCompleted(rmContainer, containerStatus, @event); // Inform the node node.ReleaseContainer(container); // Update total usage Resources.SubtractFrom(usedResource, container.GetResource()); Log.Info("Application attempt " + application.GetApplicationAttemptId() + " released container " + container.GetId() + " on node: " + node + " with event: " + @event); } }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> public virtual StopContainersResponse StopContainers(StopContainersRequest request ) { lock (this) { foreach (ContainerId containerID in request.GetContainerIds()) { string applicationId = containerID.GetApplicationAttemptId().GetApplicationId().GetId ().ToString(); // Mark the container as COMPLETE IList <Container> applicationContainers = containers[containerID.GetApplicationAttemptId ().GetApplicationId()]; foreach (Container c in applicationContainers) { if (c.GetId().CompareTo(containerID) == 0) { ContainerStatus containerStatus = containerStatusMap[c]; containerStatus.SetState(ContainerState.Complete); containerStatusMap[c] = containerStatus; } } // Send a heartbeat try { Heartbeat(); } catch (IOException ioe) { throw RPCUtil.GetRemoteException(ioe); } // Remove container and update status int ctr = 0; Container container = null; for (IEnumerator <Container> i = applicationContainers.GetEnumerator(); i.HasNext( );) { container = i.Next(); if (container.GetId().CompareTo(containerID) == 0) { i.Remove(); ++ctr; } } if (ctr != 1) { throw new InvalidOperationException("Container " + containerID + " stopped " + ctr + " times!"); } Resources.AddTo(available, container.GetResource()); Resources.SubtractFrom(used, container.GetResource()); if (Log.IsDebugEnabled()) { Log.Debug("stopContainer:" + " node=" + containerManagerAddress + " application=" + applicationId + " container=" + containerID + " available=" + available + " used=" + used); } } return(StopContainersResponse.NewInstance(null, null)); } }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> /// <exception cref="System.IO.IOException"/> private void TestGetContainerStatus(Container container, int index, ContainerState state, string diagnostics, IList <int> exitStatuses) { while (true) { try { ContainerStatus status = nmClient.GetContainerStatus(container.GetId(), container .GetNodeId()); // NodeManager may still need some time to get the stable // container status if (status.GetState() == state) { NUnit.Framework.Assert.AreEqual(container.GetId(), status.GetContainerId()); NUnit.Framework.Assert.IsTrue(string.Empty + index + ": " + status.GetDiagnostics (), status.GetDiagnostics().Contains(diagnostics)); NUnit.Framework.Assert.IsTrue("Exit Statuses are supposed to be in: " + exitStatuses + ", but the actual exit status code is: " + status.GetExitStatus(), exitStatuses .Contains(status.GetExitStatus())); break; } Sharpen.Thread.Sleep(100); } catch (Exception e) { Sharpen.Runtime.PrintStackTrace(e); } } }
/// <summary> /// 学習履歴コンテナを削除し、ステータスを変更する。 /// </summary> /// <param name="trainingHistory">対象学習履歴</param> /// <param name="status">変更後のステータス</param> /// <param name="force">他テナントに対する変更を許可するか</param> public async Task ExitAsync(TrainingHistory trainingHistory, ContainerStatus status, bool force) { //コンテナの生存確認 if (trainingHistory.GetStatus().Exist()) { var info = await clusterManagementLogic.GetContainerDetailsInfoAsync(trainingHistory.Key, CurrentUserInfo.SelectedTenant.Name, force); if (info.Status.Exist()) { //再確認してもまだ存在していたら、コンテナ削除 await clusterManagementLogic.DeleteContainerAsync( ContainerType.Training, trainingHistory.Key, CurrentUserInfo.SelectedTenant.Name, force); } await trainingHistoryRepository.UpdateStatusAsync(trainingHistory.Id, status, info.CreatedAt, DateTime.Now, force); } else { await trainingHistoryRepository.UpdateStatusAsync(trainingHistory.Id, status, force); } //実コンテナ削除の結果は確認せず、DBの更新を確定する(コンテナがいないなら、そのまま消しても問題ない想定) unitOfWork.Commit(); }
public RMContainerState Transition(RMContainerImpl container, RMContainerEvent @event ) { NMContainerStatus report = ((RMContainerRecoverEvent)@event).GetContainerReport(); if (report.GetContainerState().Equals(ContainerState.Complete)) { ContainerStatus status = ContainerStatus.NewInstance(report.GetContainerId(), report .GetContainerState(), report.GetDiagnostics(), report.GetContainerExitStatus()); new RMContainerImpl.FinishedTransition().Transition(container, new RMContainerFinishedEvent (container.containerId, status, RMContainerEventType.Finished)); return(RMContainerState.Completed); } else { if (report.GetContainerState().Equals(ContainerState.Running)) { // Tell the app container.eventHandler.Handle(new RMAppRunningOnNodeEvent(container.GetApplicationAttemptId ().GetApplicationId(), container.nodeId)); return(RMContainerState.Running); } else { // This can never happen. Log.Warn("RMContainer received unexpected recover event with container" + " state " + report.GetContainerState() + " while recovering."); return(RMContainerState.Running); } } }
public async Task <IActionResult> PutContainerStatus(int id, ContainerStatus containerStatus) { if (id != containerStatus.ContainerStatusId) { return(BadRequest()); } _context.Entry(containerStatus).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContainerStatusExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> public virtual StartContainersResponse StartContainers(StartContainersRequest requests ) { StartContainersResponse response = TestRPC.recordFactory.NewRecordInstance <StartContainersResponse >(); foreach (StartContainerRequest request in requests.GetStartContainerRequests()) { Token containerToken = request.GetContainerToken(); ContainerTokenIdentifier tokenId = null; try { tokenId = TestRPC.NewContainerTokenIdentifier(containerToken); } catch (IOException e) { throw RPCUtil.GetRemoteException(e); } ContainerStatus status = TestRPC.recordFactory.NewRecordInstance <ContainerStatus> (); status.SetState(ContainerState.Running); status.SetContainerId(tokenId.GetContainerID()); status.SetExitStatus(0); this.statuses.AddItem(status); } return(response); }
public static ContainerStatus GetContainerStatus(this K8sPod self, string containerId) { ContainerStatus result = self.Status.ContainerStatuses?.FirstOrDefault( cs => !string.IsNullOrEmpty(cs.ContainerID) && cs.ContainerID.EndsWith(containerId, StringComparison.Ordinal)); return(result); }
public RMAppAttemptContainerFinishedEvent(ApplicationAttemptId appAttemptId, ContainerStatus containerStatus, NodeId nodeId) : base(appAttemptId, RMAppAttemptEventType.ContainerFinished) { this.containerStatus = containerStatus; this.nodeId = nodeId; }
private YarnProtos.ContainerStatusProto ConvertToProtoFormat(ContainerStatus t) { lock (this) { return(((ContainerStatusPBImpl)t).GetProto()); } }
/// <summary> /// 前処理コンテナを削除し、ステータスを変更する。 /// 削除可否の判断が必要なら、呼び出しもとで判定すること。 /// </summary> /// <param name="preprocessHistory">対象前処理履歴</param> /// <param name="force">他テナントに対する変更を許可するか</param> public async Task <bool> DeleteAsync(PreprocessHistory preprocessHistory, bool force) { // 前処理結果を削除 bool result = true; foreach (var outputDataId in preprocessHistoryRepository.GetPreprocessOutputs(preprocessHistory.Id)) { //1件でも失敗したら結果はfalse。ただし、エラーが出ても最後まで消し切る。 result &= await dataLogic.DeleteDataAsync(outputDataId); } // 前処理履歴の削除 preprocessHistoryRepository.Delete(preprocessHistory, force); // 結果に関わらずコミット unitOfWork.Commit(); var status = ContainerStatus.Convert(preprocessHistory.Status); if (status.Exist()) { //コンテナが動いていれば、停止する await clusterManagementLogic.DeleteContainerAsync( ContainerType.Preprocessing, preprocessHistory.Name, CurrentUserInfo.SelectedTenant.Name, force); } return(result); }
public virtual void ContainerCompleted(RMContainer rmContainer, ContainerStatus containerStatus , RMContainerEventType @event) { lock (this) { Container container = rmContainer.GetContainer(); ContainerId containerId = container.GetId(); // Remove from the list of newly allocated containers if found newlyAllocatedContainers.Remove(rmContainer); // Inform the container rmContainer.Handle(new RMContainerFinishedEvent(containerId, containerStatus, @event )); Log.Info("Completed container: " + rmContainer.GetContainerId() + " in state: " + rmContainer.GetState() + " event:" + @event); // Remove from the list of containers Sharpen.Collections.Remove(liveContainers, rmContainer.GetContainerId()); RMAuditLogger.LogSuccess(GetUser(), RMAuditLogger.AuditConstants.ReleaseContainer , "SchedulerApp", GetApplicationId(), containerId); // Update usage metrics Org.Apache.Hadoop.Yarn.Api.Records.Resource containerResource = rmContainer.GetContainer ().GetResource(); queue.GetMetrics().ReleaseResources(GetUser(), 1, containerResource); Resources.SubtractFrom(currentConsumption, containerResource); // remove from preemption map if it is completed Sharpen.Collections.Remove(preemptionMap, rmContainer); // Clear resource utilization metrics cache. lastMemoryAggregateAllocationUpdateTime = -1; } }
public async Task <IActionResult> UploadPreprocessImage([FromRoute] long id, [FromRoute] long dataId) { var history = await preprocessHistoryRepository.GetPreprocessIncludeDataAndPreprocessAsync(id, dataId); if (history == null) { return(JsonNotFound($"Preprocessing History about Preprocess {id} to Data {dataId} is not found.")); } var status = ContainerStatus.Convert(history.Status); if (status.Exist() == false) { return(JsonBadRequest($"A container for the preprocessing does not exist.")); } var events = await clusterManagementLogic.GetEventsAsync(CurrentUserInfo.SelectedTenant, history.Name, false, true); if (events.IsSuccess == false) { return(JsonError(HttpStatusCode.ServiceUnavailable, $"Failed to get container events: {events.Error}")); } else { return(JsonOK(events.Value)); } }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> /// <exception cref="System.IO.IOException"/> public override ContainerStatus GetContainerStatus(ContainerId containerId, NodeId nodeId) { ContainerManagementProtocolProxy.ContainerManagementProtocolProxyData proxy = null; IList <ContainerId> containerIds = new AList <ContainerId>(); containerIds.AddItem(containerId); try { proxy = cmProxy.GetProxy(nodeId.ToString(), containerId); GetContainerStatusesResponse response = proxy.GetContainerManagementProtocol().GetContainerStatuses (GetContainerStatusesRequest.NewInstance(containerIds)); if (response.GetFailedRequests() != null && response.GetFailedRequests().Contains (containerId)) { Exception t = response.GetFailedRequests()[containerId].DeSerialize(); ParseAndThrowException(t); } ContainerStatus containerStatus = response.GetContainerStatuses()[0]; return(containerStatus); } finally { if (proxy != null) { cmProxy.MayBeCloseProxy(proxy); } } }
public virtual void TestExpiredContainer() { // Start the node node.Handle(new RMNodeStartedEvent(null, null, null)); Org.Mockito.Mockito.Verify(scheduler).Handle(Matchers.Any <NodeAddedSchedulerEvent >()); // Expire a container ContainerId completedContainerId = BuilderUtils.NewContainerId(BuilderUtils.NewApplicationAttemptId (BuilderUtils.NewApplicationId(0, 0), 0), 0); node.Handle(new RMNodeCleanContainerEvent(null, completedContainerId)); NUnit.Framework.Assert.AreEqual(1, node.GetContainersToCleanUp().Count); // Now verify that scheduler isn't notified of an expired container // by checking number of 'completedContainers' it got in the previous event RMNodeStatusEvent statusEvent = GetMockRMNodeStatusEvent(); ContainerStatus containerStatus = Org.Mockito.Mockito.Mock <ContainerStatus>(); Org.Mockito.Mockito.DoReturn(completedContainerId).When(containerStatus).GetContainerId (); Org.Mockito.Mockito.DoReturn(Sharpen.Collections.SingletonList(containerStatus)). When(statusEvent).GetContainers(); node.Handle(statusEvent); /* Expect the scheduler call handle function 2 times * 1. RMNode status from new to Running, handle the add_node event * 2. handle the node update event */ Org.Mockito.Mockito.Verify(scheduler, Org.Mockito.Mockito.Times(2)).Handle(Matchers.Any <NodeUpdateSchedulerEvent>()); }
/// <summary> /// 学習履歴のステータスを変更する。 /// 存在チェックは行わない。 /// </summary> /// <param name="id">学習履歴ID</param> /// <param name="status">変更後のステータス</param> /// <param name="force">他テナントに対する変更を許可するか</param> public async Task UpdateStatusAsync(long id, ContainerStatus status, bool force) { var history = await this.GetByIdAsync(id, force); history.Status = status.Key; UpdateModel <TrainingHistory>(history, force); }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> /// <exception cref="System.IO.IOException"/> /// <exception cref="System.Exception"/> public virtual void TestCallAMRMClientAsyncStopFromCallbackHandlerWithWaitFor() { Configuration conf = new Configuration(); TestAMRMClientAsync.TestCallbackHandler2 callbackHandler = new TestAMRMClientAsync.TestCallbackHandler2 (this); AMRMClient <AMRMClient.ContainerRequest> client = Org.Mockito.Mockito.Mock <AMRMClientImpl >(); IList <ContainerStatus> completed = Arrays.AsList(ContainerStatus.NewInstance(NewContainerId (0, 0, 0, 0), ContainerState.Complete, string.Empty, 0)); AllocateResponse response = CreateAllocateResponse(completed, new AList <Container >(), null); Org.Mockito.Mockito.When(client.Allocate(Matchers.AnyFloat())).ThenReturn(response ); AMRMClientAsync <AMRMClient.ContainerRequest> asyncClient = AMRMClientAsync.CreateAMRMClientAsync (client, 20, callbackHandler); callbackHandler.asynClient = asyncClient; asyncClient.Init(conf); asyncClient.Start(); Supplier <bool> checker = new _Supplier_320(callbackHandler); asyncClient.RegisterApplicationMaster("localhost", 1234, null); asyncClient.WaitFor(checker); NUnit.Framework.Assert.IsTrue(checker.Get()); }
public async Task <IActionResult> GetTensorBoardStatus(long id, [FromServices] IOptions <ContainerManageOptions> options) { //データの存在チェック var trainingHistory = await trainingHistoryRepository.GetByIdAsync(id); if (trainingHistory == null) { return(JsonNotFound($"Training ID {id} is not found.")); } //学習履歴IDとテナントIDが等しく、Disable状態じゃないコンテナをDBから取得する TensorBoardContainer container = tensorBoardContainerRepository.GetAvailableContainer(id); //以下、Jsonで返却するパラメータ ContainerStatus status = ContainerStatus.None; //コンテナのステータス // 対象コンテナ情報が存在する場合、その結果を返す if (container != null) { //コンテナのステータスを最新にする status = await clusterManagementLogic.SyncContainerStatusAsync(container, false); } return(JsonOK(new TensorBoardOutputModel(container, status, options.Value.WebEndPoint))); }
private void setStatusByMatchResult(double matchResult) { if (matchResult >= this.fullLimitNumber) { containerStatus = ContainerStatus.Overloaded; } else { if (matchResult < this.fullLimitNumber && matchResult >= this.halfFullLimitNumber) { containerStatus = ContainerStatus.Full; } else { if (matchResult < this.halfFullLimitNumber && matchResult >= this.emptyLimitNumber) { containerStatus = ContainerStatus.HalfFull; this.isOverLoadedMessageSent = false; this.isFullMessageSent = false; } else { containerStatus = ContainerStatus.Empty; this.isOverLoadedMessageSent = false; this.isFullMessageSent = false; } } } }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 50, Configuration.FieldSeparator), Id, ExternalAccessionIdentifier?.ToDelimitedString(), AccessionIdentifier?.ToDelimitedString(), ContainerIdentifier?.ToDelimitedString(), PrimaryParentContainerIdentifier?.ToDelimitedString(), EquipmentContainerIdentifier?.ToDelimitedString(), SpecimenSource, RegistrationDateTime.HasValue ? RegistrationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ContainerStatus?.ToDelimitedString(), CarrierType?.ToDelimitedString(), CarrierIdentifier?.ToDelimitedString(), PositionInCarrier?.ToDelimitedString(), TrayTypeSac?.ToDelimitedString(), TrayIdentifier?.ToDelimitedString(), PositionInTray?.ToDelimitedString(), Location != null ? string.Join(Configuration.FieldRepeatSeparator, Location.Select(x => x.ToDelimitedString())) : null, ContainerHeight.HasValue ? ContainerHeight.Value.ToString(Consts.NumericFormat, culture) : null, ContainerDiameter.HasValue ? ContainerDiameter.Value.ToString(Consts.NumericFormat, culture) : null, BarrierDelta.HasValue ? BarrierDelta.Value.ToString(Consts.NumericFormat, culture) : null, BottomDelta.HasValue ? BottomDelta.Value.ToString(Consts.NumericFormat, culture) : null, ContainerHeightDiameterDeltaUnits?.ToDelimitedString(), ContainerVolume.HasValue ? ContainerVolume.Value.ToString(Consts.NumericFormat, culture) : null, AvailableSpecimenVolume.HasValue ? AvailableSpecimenVolume.Value.ToString(Consts.NumericFormat, culture) : null, InitialSpecimenVolume.HasValue ? InitialSpecimenVolume.Value.ToString(Consts.NumericFormat, culture) : null, VolumeUnits?.ToDelimitedString(), SeparatorType?.ToDelimitedString(), CapType?.ToDelimitedString(), Additive != null ? string.Join(Configuration.FieldRepeatSeparator, Additive.Select(x => x.ToDelimitedString())) : null, SpecimenComponent?.ToDelimitedString(), DilutionFactor?.ToDelimitedString(), Treatment?.ToDelimitedString(), Temperature?.ToDelimitedString(), HemolysisIndex.HasValue ? HemolysisIndex.Value.ToString(Consts.NumericFormat, culture) : null, HemolysisIndexUnits?.ToDelimitedString(), LipemiaIndex.HasValue ? LipemiaIndex.Value.ToString(Consts.NumericFormat, culture) : null, LipemiaIndexUnits?.ToDelimitedString(), IcterusIndex.HasValue ? IcterusIndex.Value.ToString(Consts.NumericFormat, culture) : null, IcterusIndexUnits?.ToDelimitedString(), FibrinIndex.HasValue ? FibrinIndex.Value.ToString(Consts.NumericFormat, culture) : null, FibrinIndexUnits?.ToDelimitedString(), SystemInducedContaminants != null ? string.Join(Configuration.FieldRepeatSeparator, SystemInducedContaminants.Select(x => x.ToDelimitedString())) : null, DrugInterference != null ? string.Join(Configuration.FieldRepeatSeparator, DrugInterference.Select(x => x.ToDelimitedString())) : null, ArtificialBlood?.ToDelimitedString(), SpecialHandlingCode != null ? string.Join(Configuration.FieldRepeatSeparator, SpecialHandlingCode.Select(x => x.ToDelimitedString())) : null, OtherEnvironmentalFactors != null ? string.Join(Configuration.FieldRepeatSeparator, OtherEnvironmentalFactors.Select(x => x.ToDelimitedString())) : null, ContainerLength?.ToDelimitedString(), ContainerWidth?.ToDelimitedString(), ContainerForm?.ToDelimitedString(), ContainerMaterial?.ToDelimitedString(), ContainerCommonName?.ToDelimitedString() ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public virtual void TestCreateAbnormalContainerStatus() { ContainerStatus cd = SchedulerUtils.CreateAbnormalContainerStatus(ContainerId.NewContainerId (ApplicationAttemptId.NewInstance(ApplicationId.NewInstance(Runtime.CurrentTimeMillis (), 1), 1), 1), "x"); NUnit.Framework.Assert.AreEqual(ContainerExitStatus.Aborted, cd.GetExitStatus()); }
/// <summary> /// ノートブック履歴のステータスを変更する。 /// 存在チェックは行わない。 /// </summary> /// <param name="id">ノートブック履歴ID</param> /// <param name="status">変更後のステータス</param> /// <param name="completedAt">停止日時</param> /// <param name="force">他テナントに対する変更を許可するか</param> public async Task UpdateStatusAsync(long id, ContainerStatus status, DateTime completedAt, bool force) { var history = await this.GetByIdAsync(id, force); history.CompletedAt = completedAt; history.Status = status.Key; UpdateModel <NotebookHistory>(history, force); }