How to use kill method of Support Package

Best Unobtainium_ruby code snippet using Support.kill

JobManagerSupport.java

Source:JobManagerSupport.java Github

copy

Full Screen

...71 departmentManager.syncJobsWithTask(job);72 }73 if (isManualKill) {74 logger.info(job.getName() + "/" + job.getId() +75 " is being manually killed by " + source.toString());76 /**77 * Sleep a bit here in case any frames were78 * dispatched during the job shutdown process.79 */80 try {81 Thread.sleep(3000);82 } catch (InterruptedException e1) {83 logger.info(job.getName() + "/" + job.getId() +84 " shutdown thread was interrupted.");85 }86 FrameSearchInterface search = frameSearchFactory.create(job);87 FrameSearchCriteria newCriteria = search.getCriteria();88 FrameStateSeq states = newCriteria.getStates().toBuilder()89 .addFrameStates(FrameState.RUNNING)90 .build();91 search.setCriteria(newCriteria.toBuilder().setStates(states).build());92 for (FrameInterface frame: jobManager.findFrames(search)) {93 VirtualProc proc = null;94 try {95 proc = hostManager.findVirtualProc(frame);96 }97 catch (DataAccessException e) {98 logger.warn("Unable to find proc to kill frame " + frame +99 " on job shutdown operation, " + e);100 }101 if (manualStopFrame(frame, FrameState.WAITING)) {102 try {103 if (proc != null) {104 kill(proc, source);105 }106 } catch (DataAccessException e) {107 logger.warn("Failed to kill frame " + frame +108 " on job shutdown operation, " + e);109 }110 catch (Exception e) {111 logger.warn("error killing frame: " + frame);112 }113 }114 }115 }116 /*117 * Send mail after all frames have been stopped or else the email118 * will have inaccurate numbers.119 */120 emailSupport.sendShutdownEmail(job);121 return true;122 }123 return false;124 }125 public void reorderJob(JobInterface job, FrameSet frameSet, Order order) {126 List<LayerInterface> layers = jobManager.getLayers(job);127 for (LayerInterface layer: layers) {128 jobManager.reorderLayer(layer, frameSet, order);129 }130 }131 public void reorderLayer(LayerInterface layer, FrameSet frameSet, Order order) {132 jobManager.reorderLayer(layer, frameSet, order);133 }134 public void staggerJob(JobInterface job, String range, int stagger) {135 List<LayerInterface> layers = jobManager.getLayers(job);136 for (LayerInterface layer: layers) {137 jobManager.staggerLayer(layer, range, stagger);138 }139 }140 public void staggerLayer(LayerInterface layer, String range, int stagger) {141 jobManager.staggerLayer(layer, range, stagger);142 }143 public void satisfyWhatDependsOn(FrameInterface frame) {144 List<LightweightDependency> depends = dependManager.getWhatDependsOn(frame);145 logger.info("satisfying " + depends.size() +146 " depends that are waiting on frame " + frame.getName());147 for (LightweightDependency depend: depends) {148 dependManager.satisfyDepend(depend);149 }150 }151 public void satisfyWhatDependsOn(LayerInterface layer) {152 List<LightweightDependency> depends = dependManager.getWhatDependsOn(layer);153 logger.info("satisfying " + depends.size() +154 " depends that are waiting on layer " + layer.getName());155 for (LightweightDependency depend: dependManager.getWhatDependsOn(layer)) {156 dependManager.satisfyDepend(depend);157 }158 }159 public void satisfyWhatDependsOn(JobInterface job) {160 List<LightweightDependency> depends = dependManager.getWhatDependsOn(job);161 logger.info("satisfying " + depends.size() +162 " depends that are waiting on job " + job.getName());163 for (LightweightDependency depend: dependManager.getWhatDependsOn(job)) {164 dependManager.satisfyDepend(depend);165 }166 }167 public void satisfyWhatDependsOn(JobInterface job, DependTarget target) {168 for (LightweightDependency depend: dependManager.getWhatDependsOn(job, target)) {169 dependManager.satisfyDepend(depend);170 }171 }172 public void satisfyWhatDependsOn(FrameSearchInterface request) {173 for (FrameInterface frame: jobManager.findFrames(request)) {174 for (LightweightDependency depend: dependManager.getWhatDependsOn(frame)) {175 dependManager.satisfyDepend(depend);176 }177 }178 }179 /*180 * Destructive functions require a extra Source argument which contains181 * information about the user making the call. This information is182 * propagated down to the frame log file.183 *184 * There are three main destructive functions.185 * kill, retry, and eat.186 *187 * Before a frame is retried or eaten, the new frame state must be188 * set and committed to the DB before the call to RQD is made to189 * actually kill the frame. This will tell the dispatcher what190 * to do with the frame when RQD sends in the FrameCompleteReport.191 *192 * See RqdReportManagerService.determineFrameState193 */194 /**195 * Kill the specified frame. If RQD throws back an196 * exception, the proc is considered lost and is197 * manually removed.198 *199 * @param p200 * @param source201 */202 public void kill(VirtualProc p, Source source) {203 try {204 rqdClient.killFrame(p, source.toString());205 }206 catch (java.lang.Throwable e) {207 dispatchSupport.lostProc(p, "clearing due to failed kill," +208 p.getName() + "," + e, Dispatcher.EXIT_STATUS_FAILED_KILL);209 }210 }211 /**212 * Kill a list procs. If RQD throws back an213 * exception, the proc is considered lost and is214 * manually removed.215 *216 * @param procs217 * @param source218 */219 public void kill(Collection<VirtualProc> procs, Source source) {220 for (VirtualProc p: procs) {221 try {222 rqdClient.killFrame(p, source.toString());223 }224 catch (java.lang.Throwable e) {225 dispatchSupport.lostProc(p, "clearing due to failed kill," +226 p.getName() + "," + e, Dispatcher.EXIT_STATUS_FAILED_KILL);227 }228 }229 }230 /**231 * Kills a frame. This is a convenience method for when you have232 * a reference to the Frame and233 *234 * @param frame235 * @param source236 */237 public void kill(FrameInterface frame, Source source) {238 kill(hostManager.findVirtualProc(frame), source);239 }240 /**241 * Unbook and optionally kill all procs that match the specified242 * search criteria.243 *244 * @param r245 * @param killProc246 * @param source247 * @return248 */249 public int unbookProcs(ProcSearchInterface r, boolean killProc, Source source) {250 List<VirtualProc> procs = hostManager.findBookedVirtualProcs(r);251 for (VirtualProc proc: procs) {252 unbookProc(proc, killProc, source);253 }254 return procs.size();255 }256 /**257 * Unbook and optionally kill all procs that match the specified258 * search criteria.259 *260 * @param proc261 * @param killProc262 * @param source263 * @return264 */265 public void unbookProc(VirtualProc proc, boolean killProc, Source source) {266 hostManager.unbookProc(proc);267 if (killProc) {268 kill(proc, source);269 }270 }271 /**272 * Kill procs and optionally unbook them as well.273 *274 * @param host275 * @param source276 * @param unbook277 */278 public void killProcs(HostInterface host, Source source, boolean unbook) {279 List<VirtualProc> procs = hostManager.findVirtualProcs(host);280 if (unbook) {281 hostManager.unbookVirtualProcs(procs);282 }283 for (VirtualProc proc: procs) {284 kill(proc, source);285 }286 }287 /**288 * Kill procs and optionally unbook them as well.289 *290 * @param r291 * @param source292 * @param unbook293 */294 public void killProcs(FrameSearchInterface r, Source source, boolean unbook) {295 FrameSearchCriteria newCriteria =296 r.getCriteria().toBuilder().setStates(FrameStateSeq.newBuilder().build()).build();297 r.setCriteria(newCriteria);298 List<VirtualProc> procs = hostManager.findVirtualProcs(r);299 if (unbook) {300 hostManager.unbookVirtualProcs(procs);301 }302 for (VirtualProc proc: procs) {303 kill(proc, source);304 }305 }306 /**307 * Kill procs and optionally unbook them as well.308 *309 * @param job310 * @param source311 * @param unbook312 */313 public void killProcs(JobInterface job, Source source, boolean unbook) {314 List<VirtualProc> procs = hostManager.findVirtualProcs(frameSearchFactory.create(job));315 if (unbook) {316 hostManager.unbookVirtualProcs(procs);317 }318 for (VirtualProc proc: procs) {319 kill(proc, source);320 }321 }322 /**323 * Retry frames that match the specified FrameSearch request.324 *325 * @param request326 * @param source327 */328 public void retryFrames(FrameSearchInterface request, Source source) {329 for (FrameInterface frame: jobManager.findFrames(request)) {330 try {331 retryFrame(frame, source);332 } catch (Exception e) {333 CueExceptionUtil.logStackTrace("Failed to retry frame " + frame +334 " from source " + source, e);335 }336 }337 }338 /**339 * Retry a single frame.340 *341 * @param frame342 * @param source343 */344 public void retryFrame(FrameInterface frame, Source source) {345 /**346 * Have to find the proc before we stop the frame.347 */348 VirtualProc proc = null;349 try {350 proc = hostManager.findVirtualProc(frame);351 } catch (EmptyResultDataAccessException e) {352 logger.info("failed to obtain information for " +353 "proc running on frame: " + frame);354 }355 if (manualStopFrame(frame, FrameState.WAITING)) {356 if (proc != null) {357 redirectManager.addRedirect(proc, (JobInterface) proc, false, source);358 kill(proc, source);359 }360 }361 else {362 jobManager.updateFrameState(frame, FrameState.WAITING);363 }364 /**365 * If a frame is retried that was part of a dependency, that366 * dependency should become active again.367 */368 // Handle FrameOnFrame depends.369 for (LightweightDependency depend: dependManager.getWhatDependsOn(370 frame, false)) {371 dependManager.unsatisfyDepend(depend);372 }373 // Handle LayerOnLayer depends.374 for (LightweightDependency depend: dependManager.getWhatDependsOn(375 (LayerInterface) frame, false)) {376 dependManager.unsatisfyDepend(depend);377 }378 }379 /**380 * Eat frames that match the specified FrameSearch. Eaten381 * frames are considered "Succeeded" by the dispatcher.382 * A Job with all eaten frames will leave the cue.383 *384 * @param request385 * @param source386 */387 public void eatFrames(FrameSearchInterface request, Source source) {388 for (FrameInterface frame: jobManager.findFrames(request)) {389 eatFrame(frame, source);390 }391 }392 /**393 * Eat the specified frame. Eaten frames are394 * considered "Succeeded" by the dispatcher. A Job395 * with all eaten frames will leave the cue.396 *397 * @param frame398 * @param source399 */400 public void eatFrame(FrameInterface frame, Source source) {401 /**402 * Have to find the proc before we stop the frame.403 */404 VirtualProc proc = null;405 try {406 proc = hostManager.findVirtualProc(frame);407 } catch (EmptyResultDataAccessException e) {408 logger.info("failed to obtain information " +409 "for proc running on frame: " + frame);410 }411 if (manualStopFrame(frame, FrameState.EATEN)) {412 if (proc != null) {413 kill(proc, source);414 }415 }416 else {417 jobManager.updateFrameState(frame, FrameState.EATEN);418 }419 if (jobManager.isJobComplete(frame)) {420 queueShutdownJob(frame, source, false);421 }422 }423 /**424 * Marks the result of the specified frame search as425 * FrameState.Waiting and decrease the depend count to 0426 * no matter how many active depends exists.427 *...

Full Screen

Full Screen

SecKillActivity.java

Source:SecKillActivity.java Github

copy

Full Screen

1package com.mysheng.office.kkanshop;2import android.os.Bundle;3import android.support.annotation.Nullable;4import android.support.v4.app.Fragment;5import android.support.v4.app.FragmentActivity;6import android.support.v4.app.FragmentPagerAdapter;7import android.support.v4.view.ViewPager;8import android.view.View;9import android.widget.ImageView;10import com.mysheng.office.kkanshop.view.ViewPagerIndicator;11import java.util.ArrayList;12import java.util.Calendar;13import java.util.List;14/**15 * Created by myaheng on 2018/9/28.16 */17public class SecKillActivity extends FragmentActivity implements View.OnClickListener {18 private ImageView comeBack;19 private ImageView screen;20 private ViewPager secKillPager;21 private ViewPagerIndicator secKillIndicator;22 private List<String> mTitle=new ArrayList<>();23 private FragmentPagerAdapter adapter;24 private List<Fragment> listFragment=new ArrayList<>();25 @Override26 protected void onCreate(@Nullable Bundle savedInstanceState) {27 super.onCreate(savedInstanceState);28 setContentView(R.layout.common_viewpager_layout);29 comeBack=findViewById(R.id.comeBack);30 //screen=findViewById(R.id.screen);31 secKillPager=findViewById(R.id.viewpager);32 secKillIndicator=findViewById(R.id.id_indicator);33 initEvent();34 initData();35 }36 private void initData() {37 Calendar calendar = Calendar.getInstance();38 int hour=calendar.get(Calendar.HOUR_OF_DAY);39 String title="";40 for(int i=0;i<4;i++){41 title=hour>9?hour+":00场":"0"+hour+":00场";42 SecKillItemFragment fragment=SecKillItemFragment.getInstance(i);43 listFragment.add(fragment);44 hour=hour+2;45 mTitle.add(title);46 }47 secKillIndicator.setTabItemTitle(mTitle);48 secKillIndicator.setViewPager(secKillPager,0);49 adapter=new FragmentPagerAdapter(getSupportFragmentManager()) {50 @Override51 public Fragment getItem(int position) {52 return listFragment.get(position);53 }54 @Override55 public int getCount() {56 return listFragment.size();57 }58 };59 secKillPager.setAdapter(adapter);60 }61 private void initEvent() {62 comeBack.setOnClickListener(this);63 // screen.setOnClickListener(this);64 }65 @Override66 public void onClick(View v) {67 switch (v.getId()){68 case R.id.comeBack:69 finish();70 break;71 case R.id.screen:72 screenItem();73 break;74 }75 }76 private void screenItem() {77 }78}...

Full Screen

Full Screen

HardTimeoutExpirationPolicy.java

Source:HardTimeoutExpirationPolicy.java Github

copy

Full Screen

...28 */29public final class HardTimeoutExpirationPolicy extends AbstractCasExpirationPolicy {30 /** Serialization support. */31 private static final long serialVersionUID = 6728077010285422290L;32 /** The time to kill in milliseconds. */33 private final long timeToKillInMilliSeconds;34 /** No-arg constructor for serialization support. */35 private HardTimeoutExpirationPolicy() {36 this.timeToKillInMilliSeconds = 0;37 }38 /**39 * Instantiates a new hard timeout expiration policy.40 *41 * @param timeToKillInMilliSeconds the time to kill in milli seconds42 */43 public HardTimeoutExpirationPolicy(final long timeToKillInMilliSeconds) {44 this.timeToKillInMilliSeconds = timeToKillInMilliSeconds;45 }46 /**47 * Instantiates a new Hard timeout expiration policy.48 *49 * @param timeToKill the time to kill50 * @param timeUnit the time unit51 */52 public HardTimeoutExpirationPolicy(final long timeToKill, final TimeUnit timeUnit) {53 this.timeToKillInMilliSeconds = timeUnit.toMillis(timeToKill);54 }55 @Override56 public boolean isExpired(final TicketState ticketState) {57 return (ticketState == null)58 || (System.currentTimeMillis() - ticketState.getCreationTime() >= this.timeToKillInMilliSeconds);59 }60}...

Full Screen

Full Screen

kill

Using AI Code Generation

copy

Full Screen

1 Support.kill(self)2 def self.kill(obj)3 kill(self)4 def kill(obj)5 One.kill(self)6 def kill(obj)7 Support.kill(self)8 def self.kill(obj)9 kill(self)10 def kill(obj)

Full Screen

Full Screen

kill

Using AI Code Generation

copy

Full Screen

1obj.add(5,5)2obj.sub(5,5)3obj.kill("Himanshu")4 def add(x,y)5 def sub(x,y)6 def kill(name)7obj.add(5,5)8obj.sub(5,5)9obj.kill("Himanshu")

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Unobtainium_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful