fs12345 wrote > 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 : > Hello, > > I not sure, what I all understood correctly. > But I would used support asynchronous operation, and cancel IgniteFuture > if needed. > For example: > 1) Create cluster group by attribute > cg = cluster.forAttribute("ROLE", "worker"); > 2) Make compute async > c = igniteClient.compute(cg).withAsync() > 3) Start executing task > c.call(job) > IgniteFuture f = c.future() > 4) cancel or wait result > f.cancel() > f.get() > > 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-tp5027p5033.html Sent from the Apache Ignite Users mailing list archive at Nabble.com.