[ 
https://issues.apache.org/jira/browse/IGNITE-27855?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel Tupitsyn updated IGNITE-27855:
------------------------------------
    Description: 
As a user, I want to cancel queries in my compute job when the job is 
cancelled, by passing *JobExecutionContext#cancellationToken* to those queries.

Currently, I have to poll *JobExecutionContext#isCancelled* and manually 
orchestrate cancellation with *CancelHandle* and *CancellationToken*.

Usage example:
{code:java}
private static class CreateTableJob implements ComputeJob<String, Void> {
    @Override
    public CompletableFuture<Void> executeAsync(JobExecutionContext context, 
String tableName) {
        return context.ignite().sql()
                .executeAsync((Transaction) null, context.cancellationToken(), 
"CREATE TABLE " + tableName + "(key BIGINT PRIMARY KEY, val INT)")
                .thenApply(x -> null);
    }
}
{code}


  was:
As a user, I want to cancel queries in my compute job when the job is 
cancelled, by passing *JobExecutionContext#cancellationToken* to those queries.

Currently, I have to poll *JobExecutionContext#isCancelled* and manually 
orchestrate cancellation with *CancelHandle* and *CancellationToken*.




> Add JobExecutionContext#cancellationToken
> -----------------------------------------
>
>                 Key: IGNITE-27855
>                 URL: https://issues.apache.org/jira/browse/IGNITE-27855
>             Project: Ignite
>          Issue Type: Improvement
>          Components: compute ai3
>            Reporter: Pavel Tupitsyn
>            Priority: Major
>              Labels: ignite-3
>             Fix For: 3.2
>
>
> As a user, I want to cancel queries in my compute job when the job is 
> cancelled, by passing *JobExecutionContext#cancellationToken* to those 
> queries.
> Currently, I have to poll *JobExecutionContext#isCancelled* and manually 
> orchestrate cancellation with *CancelHandle* and *CancellationToken*.
> Usage example:
> {code:java}
> private static class CreateTableJob implements ComputeJob<String, Void> {
>     @Override
>     public CompletableFuture<Void> executeAsync(JobExecutionContext context, 
> String tableName) {
>         return context.ignite().sql()
>                 .executeAsync((Transaction) null, 
> context.cancellationToken(), "CREATE TABLE " + tableName + "(key BIGINT 
> PRIMARY KEY, val INT)")
>                 .thenApply(x -> null);
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to