ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fs12345 <florian.spinn...@gmail.com>
Subject Cancel tasks on Ignite compute grid worker nodes
Date Thu, 19 May 2016 10:21:53 GMT
Hi all,

Let me start by saying I am quite a novice with Apache Ignite. 

Here is my question : I want to be able to monitor and cancel tasks running
or that are going to run on worker nodes of an Ignite Cluster (say for
example if one task takes too long to complete), and without using Visor. 

I tried to query all EVTS_TASK_EXECUTION events (from EventType) on all
nodes as follows:

Ignite grid = Ignition.ignite("GRID_NAME");
Collection<Event> allEvents = grid.events().remoteQuery(event -> true,0,
EventType.EVTS_TASK_EXECUTION)
for (Event evt : allEvents){
	TaskEvent taskEvent = (TaskEvent) evt;
	System.out.println(taskEvent);
}

Each TaskEvent,  has a taskSessionId() method, and a .node() method. It
seems that the .node() method returns the client node that originated the
task with the corresponding IgniteUuid returned by taskSessionId().

On the other hand, when looking at ClusterMetrics for worker nodes I can
retrieve the number of Jobs currently running on Worker Nodes, current CPU
load etc : 

ClusterGroup workerNodes = grid.cluster().forAttribute("ROLE","WORKER");
for(ClusterNode node : workerNodes.nodes()){
	System.out.println(node.metrics().getCurrentActiveJobs());
}

How could I 
	1) Cancel tasks currently being run on worker nodes (whose number are
displayed in the result of getCurrentActiveJobs()) or 
	2) Cancel tasks dispatched by the clients nodes, for which I have an
IgniteUuid ,
	
possibly without using grid.close() or such hard methods.

Thanks for your help




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cancel-tasks-on-Ignite-compute-grid-worker-nodes-tp5027.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message