-
Notifications
You must be signed in to change notification settings - Fork 0
/
JobAsyncWrapper.cs
72 lines (66 loc) · 2.66 KB
/
JobAsyncWrapper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System.Threading;
using System;
namespace QarnotSDK {
/// <summary>
/// This class manages Jobs life cycle: logical group of tasks.
/// </summary>
public partial class QJob
{
/// <summary>
/// Submit this job.
/// </summary>
/// <param name="cancellationToken">Optional token to cancel the request.</param>
/// <returns></returns>
[Obsolete("Submit is deprecated, please use SubmitAsync instead.")]
public virtual void Submit(CancellationToken cancellationToken=default(CancellationToken))
{
try {
SubmitAsync(cancellationToken).Wait();
} catch (AggregateException ex) {
throw ex.InnerException;
}
}
/// <summary>
/// Update this job.
/// </summary>
/// <param name="cancellationToken">Optional token to cancel the request.</param>
/// <returns></returns>
[Obsolete("UpdateStatus is deprecated, please use UpdateStatusAsync instead.")]
public virtual void UpdateStatus(CancellationToken cancellationToken = default(CancellationToken)) {
try {
UpdateStatusAsync(cancellationToken).Wait();
} catch (AggregateException ex) {
throw ex.InnerException;
}
}
/// <summary>
/// Terminate an active job. (will cancel all remaining tasks)
/// </summary>
/// <param name="cancellationToken">Optional token to cancel the request.</param>
/// <returns></returns>
[Obsolete("Terminate is deprecated, please use TerminateAsync instead.")]
public virtual void Terminate(CancellationToken cancellationToken = default(CancellationToken))
{
try {
TerminateAsync(cancellationToken).Wait();
} catch (AggregateException ex) {
throw ex.InnerException;
}
}
/// <summary>
/// Delete the job. If the job is active, the job is terminated and deleted.
/// </summary>
/// <param name="force">Optional boolean to force inner tasks to be deleted.</param>
/// <param name="cancellationToken">Optional token to cancel the request.</param>
/// <returns></returns>
[Obsolete("Delete is deprecated, please use DeleteAsync instead.")]
public virtual void Delete(bool force = false, CancellationToken cancellationToken = default(CancellationToken))
{
try {
DeleteAsync(force, cancellationToken).Wait();
} catch (AggregateException ex) {
throw ex.InnerException;
}
}
}
}