投稿時間:2023-01-30 02:08:20 RSSフィード2023-01-30 02:00 分まとめ(10件)
カテゴリー等 | サイト名等 | 記事タイトル・トレンドワード等 | リンクURL | 頻出ワード・要約等/検索ボリューム | 登録日 |
---|---|---|---|---|---|
python | Pythonタグが付けられた新着投稿 - Qiita | 基本的なSortをmatplotlibでアニメーションにしてみた | https://qiita.com/ZawaP/items/622188e5d364c5e78ddb | application | 2023-01-30 01:31:54 |
Ruby | Rubyタグが付けられた新着投稿 - Qiita | Seleniumを用いてkindleハイライトを取り出す。(未完成) | https://qiita.com/yuwan7020/items/f72e94c8cae817513898 | amazon | 2023-01-30 01:12:16 |
海外TECH | MakeUseOf | How to Group (and Ungroup) Elements on Canva | https://www.makeuseof.com/how-to-group-ungroup-canva-elements/ | canva | 2023-01-29 16:30:16 |
海外TECH | MakeUseOf | 7 Ancient Windows Features You Can Still Find in Windows 11 | https://www.makeuseof.com/ancient-windows-features-still-in-windows-11/ | windows | 2023-01-29 16:15:15 |
海外TECH | DEV Community | Kubernetes Pods Stuck in Terminating: A Resolution Guide | https://dev.to/imjoseangel/kubernetes-pods-stuck-in-terminating-a-resolution-guide-2jh3 | Kubernetes Pods Stuck in Terminating A Resolution GuideDo you know why a Pod takes too much time to get deleted or even hangs on the Terminating state This post describes the Pod Lifecycle conditions reasons why they could hang in the Terminating state and some tips to get rid of them Pod TerminationThere are multiple reasons why the Kubernetes Scheduler can evict a healthy container For example the execution of Pods with higher priority the drain of a node during a version update an auto scaling process a resource bin packing or a simple kubectl delete command Kubernetes provides graceful termination for not needed Pods with Container Lifecycle Hooks They are executed by the kubelet on the specific containers when it receives the event When Kubelet knows that a Pod should evict it marks the Pod state as Terminating and stops sending traffic to it Then it executes the preStop lifecycle hook when available It sends the SIGTERM to the Main process pid within each container and waits for their termination If the applications inside the containers are properly prepared they will start a graceful shutdown The duration should not be more than the specified in the spec terminationGracePeriodSeconds which is seconds by default If the application has not completed the shutdown properly the Kubelet gives a grace period until removing the Pod IP and killing the container by sending a SIGKILL At this point Kubernetes removes the Pod from the API server Why a Pod can hang on Terminating stateThe most common reasons for a Pod hanging during the eviction process are A Finalizer dependencyAn incorrect terminationGracePeriodSeconds value FinalizersFrom Kubernetes documentation Finalizers are namespaced keys that tell Kubernetes to wait until specific conditions are met before it fully deletes resources marked for deletion Finalizers are used to prevent the accidental deletion of resources When a Pod hangs in the Terminating state check its metadata finalizers For instance this example has a Kubernetes key as a finalizer used for namespaces kind Podmetadata finalizers kubernetesspec containers Upon attempting to delete the pod kubectl delete pod mypod amp Kubernetes will report back that its deletion kubectl get pod mypod o yamlWhat happened is that the object was updated not deleted The Pod gets modified to include the deletion timestamp keeping it in the Terminating state creationTimestamp T Z deletionGracePeriodSeconds deletionTimestamp T Z finalizers kubernetesstatus state terminated containerID containerd bfeebbbacfeffcbddeccfdbfbfcc exitCode finishedAt T Z reason Completed startedAt T Z The PreStop hook and terminationGracePeriodSecondsFrom the Kubernetes Documentation If a PreStop hook hangs during execution the Pod s phase will be Terminating and remain there until the Pod is killed after its terminationGracePeriodSeconds expires For instance This configuration spec terminationGracePeriodSeconds containers lifecycle preStop exec command bin sh c sleep Will keep the Pod in the Terminating state for hour It is essential to handle the SIGTERM correctly and ensure that the application terminates gracefully when the kubelet sends the SIGTERM to the container Remove FinalizersDetermine if the cause of the Terminating state for a Pod Namespace or PVC is a finalizer A Finalizer example to protect PVCs from deletion is the kubernetes io pvc protection To delete the Pod patch it on the command line to remove the finalizers kubectl patch pod mypod type json p op remove path metadata finalizers orkubectl patch pod mypod p metadata finalizers null Once the finalizer list is empty the object can be reclaimed by Kubernetes and put into a queue to be deleted from the registry Force Delete the PODThe Kubernetes Documentation asserts that force deletions do not wait for confirmation from the kubelet that the Pod has been Terminated Use it with care and as a workaround solution kubectl delete pod mypod grace period force Extra Finalizers blocking Kubernetes upgradeOne or many of your Cluster node resources or availability can cause Pod eviction The kubelet monitors resources like memory disk space and filesystem inodes on your cluster s nodes When one or more of these resources reach specific consumption levels the kubelet can proactively fail one or more Pods on the node to reclaim resources and prevent starvation During a cluster version update check your node drain kubectl get nodesNAME STATUS ROLES AGE VERSIONcluster Ready SchedulingDisabled control plane m v Review the status of your Pods with kubectl get Pods ANAMESPACE NAME READY STATUS RESTARTS AGEdefault mypod Terminating mskube system etcd minikube Running mkube system kube apiserver minikube Running mkube system kube controller manager minikube Running mkube system kube proxy dwnf Running mkube system kube scheduler minikube Running mCheck Pod finalizer as usual kubectl get pod mypod o yamlapiVersion vkind Podmetadata creationTimestamp T Z deletionGracePeriodSeconds deletionTimestamp T Z finalizers kubernetesAnd patch when needed kubectl patch pod mypod p metadata finalizers null ConclusionIf you find any Kubernetes component stuck in Terminating review if any component finalizer is protecting its deletion Whether for a Pod PVC or Namespace A good example to remember is the instructions to uninstall the KEDA operator for a Kubernetes cluster here where the scaledobjects can interfere with its Namespace deletion | 2023-01-29 16:39:01 |
海外TECH | DEV Community | Creating the effect of traveling through space | https://dev.to/eyudinkov/creating-the-effect-of-traveling-through-space-mfg | Creating the effect of traveling through spaceHello everyone Today we re going to create the effect of traveling through space using javascript and canvas Let s get started TheoryThis effect is based on the simplest way of obtaining a perspective projection of a point from three dimensional space onto a plane For our case we need to divide the value of the x and y coordinates of a three dimensional point by their distance from the origin P X Px PzP Y Py Pz Environment setupLet s define the Star class that will store the states of the star and have three main methods updating the state of the star drawing the star on the screen and getting its position in D space class Star constructor getPosition update draw ctx Next we need a class that will be used to create and manage the instances of the Star class Let s call it Space and create an array of Star objects in its constructor each one representing a star class Space constructor this stars new Array STARS fill null map gt new Star It will also have three methods update draw and run The run method will iterate through the star instances by first calling the update method and then drawing them with the draw method class Space constructor this stars new Array STARS fill null map gt new Star update this stars forEach star gt star update draw ctx this stars forEach star gt star draw ctx run ctx this update this draw ctx Next we should define a new class called Canvas that will create the canvas element and call the run method of the Space class class Canvas constructor id this canvas document createElement canvas this canvas id id this canvas width window innerWidth this canvas height window innerHeight document body appendChild this canvas this ctx this canvas getContext d draw const space new Space const draw gt this ctx clearRect this canvas width this canvas height space run this ctx requestAnimationFrame draw draw Thus the preparatory part of the project has been completed and we can begin to implement its main functionality Main functionalityThe first step we need to take is to define a uniform function that generates random numbers in a given range of numbers To do this we will create a random object and implement the function in it using the Math random method const random uniform min max gt Math random max min min Once we need a class to implement the space vectors Vec since javascript does not support working with vectors What is a vector A vector is a mathematical object that describes directions in space Vectors are built from the numbers that form their components In the picture below you can see a D vector with two components Vector operationsConsider two vectors The following basic operations are defined for these vectors Addition V W Vx Wx Vy Wy Subtraction V W Vx Wx Vy Wy Division V W Vx Wx Vy Wy Scaling aV aVx aVy Multiplication V W Vx Wx Vy Wy Based on this information we will implement the main methods of working with vectors that we will need in future class Vec constructor components this components components add vec this components this components map c i gt c vec components i return this sub vec this components this components map c i gt c vec components i return this div vec this components this components map c i gt c vec components i return this scale scalar this components this components map c gt c scalar return this multiply vec this components this components map c i gt c vec components i return this ImplementationFirst let s define the center of the screen as a two dimensional vector and make a set of several colors for our stars const CENTER new Vec window innerWidth window innerHeight const COLORS FF FED CABC and also introduce the constant Z which will be used to indicate the distance along the z axis from which stars will start moving const Z Next we will assign the position of each star in three dimensional space to the attributes We will do this by implementing the getPosition method of our Star class This method uses a unit circle with a random radius to generate coordinates using sin and cos These functions are mathematically related to unit circles therefore they can be used to represent points in three dimensional space Thus we get the following code getPosition const angle random uniform Math PI const radius random uniform window innerHeight const x Math cos angle radius const y Math sin angle radius return new Vec x y Z Now let s call it in the class constructor class Star constructor this pos this getPosition Next in the constructor we set the speed of the star its color and position on the screen in terms of a two dimensional vector and its size class Star constructor this size this pos this getPosition this screenPos new Vec this vel random uniform this color COLORS Math floor Math random COLORS length Next we will move the star along the Z axis at a set speed and when it reaches its minimum value we will call a getPosition method to randomly set its new position update this pos components this vel this pos this pos components lt this getPosition this pos The coordinates of a star on the screen can be calculated by dividing the X and Y coordinates by the value of the Z component taking the center of the screen into account update this pos components this vel this pos this pos components lt this getPosition this pos this screenPos new Vec this pos components this pos components div new Vec this pos components this pos components add CENTER Next we will display the star on the screen by using the draw method To do this we use rect method draw ctx ctx fillStyle this color ctx beginPath ctx rect this screenPos components this screenPos components this size this size ctx closePath ctx fill Let s see how the stars move in real time As you can see the stars move as expected but their size does not change To solve this problem we divide the value of the Z constant by the current value of the star along the axis Z The result is as follows If you look closely you ll see that the stars that are farther away are drawn on top of the nearby stars To solve this problem we will use the so called Z Buffer and sort the stars by distance until they are drawn Let s do this sorting in the run method of the Space class run ctx this update this stars sort a b gt b pos components a pos components this draw ctx In addition we will introduce a scale factor in the getPosition method of the Star class to scale our visualization by increasing the random radius to create larger stars getPosition scale const angle random uniform Math PI const radius random uniform window innerHeight scale window innerHeight scale const x Math cos angle radius const y Math sin angle radius return new Vec x y Z and also slightly change the function for the value of the projection of the star to a more suitable one update this pos components this vel this pos this pos components lt this getPosition this pos this screenPos new Vec this pos components this pos components div new Vec this pos components this pos components add CENTER this size Z this pos components this pos components As a result we get a complete space picture In addition we can rotate the XY plane by a small angle To do this we calculate the new values of x and y using sin and cos rotateXY angle const x this components Math cos angle this components Math sin angle const y this components Math sin angle this components Math cos angle this components x this components y and call this method in the update method of the Star class update this pos components this vel this pos this pos components lt this getPosition this pos this screenPos new Vec this pos components this pos components div new Vec this pos components this pos components add CENTER this size Z this pos components this pos components this pos rotateXY As a result we get the following picture Moreover if we slightly change the initial parameters and calculate the random radius differently we can get the effect of traveling through a tunnel ConclusionWe created a visualization of movement through space and learned how to do this kind of visualization | 2023-01-29 16:16:45 |
ニュース | BBC News - Home | Nadhim Zahawi committed a serious breach of ministerial code, says Sunak | https://www.bbc.co.uk/news/uk-64444265?at_medium=RSS&at_campaign=KARANGA | affairs | 2023-01-29 16:58:44 |
ニュース | BBC News - Home | Scottish Prison Service to carry out 'urgent review' of trans inmates | https://www.bbc.co.uk/news/uk-scotland-64444530?at_medium=RSS&at_campaign=KARANGA | review | 2023-01-29 16:58:43 |
ニュース | BBC News - Home | Anthony Gordon: Newcastle sign Everton forward in £45m deal | https://www.bbc.co.uk/sport/football/64441380?at_medium=RSS&at_campaign=KARANGA | anthony | 2023-01-29 16:11:50 |
ニュース | BBC News - Home | England in South Africa: Touring bowlers struggle as Temba Bavuma hits ton as hosts win ODI series | https://www.bbc.co.uk/sport/cricket/64445126?at_medium=RSS&at_campaign=KARANGA | England in South Africa Touring bowlers struggle as Temba Bavuma hits ton as hosts win ODI seriesEngland failed to defend as Temba Bavuma s century in the second ODI helped South Africa clinch a series victory | 2023-01-29 16:45:26 |
コメント
コメントを投稿