Example #1
0
 /// <summary>
 /// Gets Jobs.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Read.
 ///
 /// Required permissions: Jobs.View.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='mandatoryPermissions'>
 /// If in a cross-folder scenario, these represent the additional permissions
 /// required in the folders the data is retrieved from; all permissions in this
 /// set must be met
 /// </param>
 /// <param name='atLeastOnePermissions'>
 /// If in a cross-folder scenario, these represent the additional permissions
 /// required in the folders the data is retrieved from; at least one permission
 /// in this set must be met
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='filter'>
 /// Restricts the set of items returned. The maximum number of expressions is
 /// 100.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 /// <param name='orderby'>
 /// Specifies the order in which items are returned. The maximum number of
 /// expressions is 5.
 /// </param>
 /// <param name='top'>
 /// Limits the number of items returned from a collection. The maximum value is
 /// 1000.
 /// </param>
 /// <param name='skip'>
 /// Excludes the specified number of items of the queried collection from the
 /// result.
 /// </param>
 /// <param name='count'>
 /// Indicates whether the total count of items within a collection are returned
 /// in the result.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ODataValueOfIEnumerableOfJobDto> GetAsync(this IJobs operations, IList <string> mandatoryPermissions = default(IList <string>), IList <string> atLeastOnePermissions = default(IList <string>), string expand = default(string), string filter = default(string), string select = default(string), string orderby = default(string), int?top = default(int?), int?skip = default(int?), bool?count = default(bool?), long?xUIPATHOrganizationUnitId = default(long?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(mandatoryPermissions, atLeastOnePermissions, expand, filter, select, orderby, top, skip, count, xUIPATHOrganizationUnitId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Gets a single job.
 /// </summary>
 /// <remarks>
 /// Required permissions: Jobs.View.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// key: Id
 /// </param>
 /// <param name='expand'>
 /// Expands related entities inline.
 /// </param>
 /// <param name='select'>
 /// Selects which properties to include in the response.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <JobDto> GetByIdAsync(this IJobs operations, long id, string expand = default(string), string select = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.GetByIdWithHttpMessagesAsync(id, expand, select, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Resumes the specified job.
 /// </summary>
 /// <remarks>
 /// Required permissions: Jobs.Edit.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resumeParameters'>
 /// The specified job key.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <JobDto> ResumeJobAsync(this IJobs operations, ResumeParameters resumeParameters, long?xUIPATHOrganizationUnitId = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.ResumeJobWithHttpMessagesAsync(resumeParameters, xUIPATHOrganizationUnitId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #4
0
 /// <summary>
 /// Gets a single job.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Read.
 ///
 /// Required permissions: Jobs.View.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='key'>
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <JobDto> GetByIdAsync(this IJobs operations, long key, string expand = default(string), string select = default(string), long?xUIPATHOrganizationUnitId = default(long?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetByIdWithHttpMessagesAsync(key, expand, select, xUIPATHOrganizationUnitId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #5
0
        public AeTitleJobProcessor(
            ClaraApplicationEntity configuration,
            IInstanceStoredNotificationService instanceStoredNotificationService,
            ILoggerFactory loggerFactory,
            IJobs jobsApi,
            IPayloads payloadsApi,
            IInstanceCleanupQueue cleanupQueue,
            IDicomToolkit dicomToolkit,
            CancellationToken cancellationToken) : base(instanceStoredNotificationService, loggerFactory, jobsApi, payloadsApi, cleanupQueue, cancellationToken)
        {
            if (loggerFactory is null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _dicomToolkit  = dicomToolkit ?? throw new ArgumentNullException(nameof(dicomToolkit));
            _instances     = new Dictionary <string, InstanceCollection>();
            _pipelines     = new Dictionary <string, string>();

            _logger = loggerFactory.CreateLogger <AeTitleJobProcessor>();

            _timer           = new System.Timers.Timer(1000);
            _timer.AutoReset = false;
            _timer.Elapsed  += OnTimedEvent;
            _timer.Enabled   = true;

            _jobs = new BlockingCollection <InstanceCollection>();

            InitializeSettings();
            _jobProcessingTask = ProcessJobs();
        }
Example #6
0
 /// <summary>
 /// Resumes the specified job.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Write.
 ///
 /// Required permissions: Jobs.Edit.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// The specified job key.
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <JobDto> ResumeJobAsync(this IJobs operations, JobsResumeJobParameters body = default(JobsResumeJobParameters), string expand = default(string), string select = default(string), long?xUIPATHOrganizationUnitId = default(long?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ResumeJobWithHttpMessagesAsync(body, expand, select, xUIPATHOrganizationUnitId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #7
0
 /// <summary>
 /// Gets Jobs.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Read.
 ///
 /// Required permissions: Jobs.View.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='expand'>
 /// Expands related entities inline.
 /// </param>
 /// <param name='filter'>
 /// Filters the results, based on a Boolean condition.
 /// </param>
 /// <param name='select'>
 /// Selects which properties to include in the response.
 /// </param>
 /// <param name='orderby'>
 /// Sorts the results.
 /// </param>
 /// <param name='top'>
 /// Returns only the first n results.
 /// </param>
 /// <param name='skip'>
 /// Skips the first n results.
 /// </param>
 /// <param name='count'>
 /// Includes a count of the matching results in the response.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ODataValueIEnumerableJobDto> GetAsync(this IJobs operations, string expand = default(string), string filter = default(string), string select = default(string), string orderby = default(string), int?top = default(int?), int?skip = default(int?), bool?count = default(bool?), long?xUIPATHOrganizationUnitId = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(expand, filter, select, orderby, top, skip, count, xUIPATHOrganizationUnitId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #8
0
 /// <summary>
 /// Adds a new job and sets it in Pending state for each robot based on the
 /// input parameters and notifies the respective robots about the pending job.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Write.
 ///
 /// Required permissions: Jobs.Create.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='startJobParameters'>
 /// StartInfo - The information required to register the new jobs.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ODataValueIEnumerableJobDto> StartJobsAsync(this IJobs operations, StartJobParameters startJobParameters = default(StartJobParameters), long?xUIPATHOrganizationUnitId = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.StartJobsWithHttpMessagesAsync(startJobParameters, xUIPATHOrganizationUnitId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #9
0
 /// <summary>
 /// Adds a new job and sets it in Pending state for each robot based on the
 /// input parameters and notifies the respective robots about the pending job.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Write.
 ///
 /// Required permissions: Jobs.Create.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// StartInfo - The information required to register the new jobs.
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='filter'>
 /// Restricts the set of items returned. The maximum number of expressions is
 /// 100.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 /// <param name='orderby'>
 /// Specifies the order in which items are returned. The maximum number of
 /// expressions is 5.
 /// </param>
 /// <param name='count'>
 /// Indicates whether the total count of items within a collection are returned
 /// in the result.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ODataValueOfIEnumerableOfJobDto> StartJobsAsync(this IJobs operations, JobsStartJobsParameters body = default(JobsStartJobsParameters), string expand = default(string), string filter = default(string), string select = default(string), string orderby = default(string), bool?count = default(bool?), long?xUIPATHOrganizationUnitId = default(long?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.StartJobsWithHttpMessagesAsync(body, expand, filter, select, orderby, count, xUIPATHOrganizationUnitId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Adds a new job and sets it in Pending state for each robot based on the
 /// input parameters and notifies the respective robots about the pending job.
 /// </summary>
 /// <remarks>
 /// Required permissions: Jobs.Create.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='startJobParameters'>
 /// StartInfo - The information required to register the new jobs.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ODataResponseListJobDto> StartJobsAsync(this IJobs operations, StartJobParameters startJobParameters = default(StartJobParameters), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.StartJobsWithHttpMessagesAsync(startJobParameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Gets Jobs.
 /// </summary>
 /// <remarks>
 /// Required permissions: Jobs.View.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='expand'>
 /// Expands related entities inline.
 /// </param>
 /// <param name='filter'>
 /// Filters the results, based on a Boolean condition.
 /// </param>
 /// <param name='select'>
 /// Selects which properties to include in the response.
 /// </param>
 /// <param name='orderby'>
 /// Sorts the results.
 /// </param>
 /// <param name='top'>
 /// Returns only the first n results.
 /// </param>
 /// <param name='skip'>
 /// Skips the first n results.
 /// </param>
 /// <param name='count'>
 /// Includes a count of the matching results in the response.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ODataResponseListJobDto> GetJobsAsync(this IJobs operations, string expand = default(string), string filter = default(string), string select = default(string), string orderby = default(string), int?top = default(int?), int?skip = default(int?), bool?count = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.GetJobsWithHttpMessagesAsync(expand, filter, select, orderby, top, skip, count, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #12
0
 public AppMenu(
     IEnumerable <IMenuItem> generalMenuItems,
     IJobs jobs,
     ILogger <AppMenu> logger)
 {
     this.generalMenuItems = generalMenuItems.ToArray();
     this.jobs             = jobs;
     this.logger           = logger;
 }
Example #13
0
 public InferenceRequestRepository(
     ILogger <InferenceRequestRepository> logger,
     IJobs jobsApi,
     IDicomAdapterRepository <InferenceRequest> inferenceRequestRepository)
 {
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
     _jobsApi = jobsApi ?? throw new ArgumentNullException(nameof(jobsApi));
     _inferenceRequestRepository = inferenceRequestRepository ?? throw new ArgumentNullException(nameof(inferenceRequestRepository));
 }
Example #14
0
 public TestOCAPIClients(SFCCEnvironmentFixture fixture)
 {
     _sitesClient             = fixture.ServiceProvider.GetService <ISites>();
     _jobsClient              = fixture.ServiceProvider.GetService <IJobs>();
     _globalPreferencesClient = fixture.ServiceProvider.GetService <IGlobalPreferences>();
     _orderSearchClient       = fixture.ServiceProvider.GetService <IOrderSearch>();
     _ordersClient            = fixture.ServiceProvider.GetService <IOrders>();
     _jobSearchClient         = fixture.ServiceProvider.GetService <IJobExecutionSearch>();
     _codeVersionsClient      = fixture.ServiceProvider.GetService <ICodeVersions>();
 }
 public MockJobProcessor(
     ClaraApplicationEntity configuration,
     IInstanceStoredNotificationService instanceStoredNotificationService,
     ILoggerFactory loggerFactory,
     IJobs jobsApi,
     IPayloads payloadsApi,
     IInstanceCleanupQueue cleanupQueue,
     CancellationToken cancellationToken) : base(instanceStoredNotificationService, loggerFactory, jobsApi, payloadsApi, cleanupQueue, cancellationToken)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }
Example #16
0
 public InferenceController(
     IInferenceRequestRepository inferenceRequestStore,
     IOptions <DicomAdapterConfiguration> configuration,
     ILogger <InferenceController> logger,
     IJobs jobsApi,
     IFileSystem fileSystem)
 {
     _inferenceRequestStore = inferenceRequestStore ?? throw new ArgumentNullException(nameof(inferenceRequestStore));
     _configuration         = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
     _jobsApi    = jobsApi ?? throw new ArgumentNullException(nameof(jobsApi));
     _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
 }
 public JobSubmissionService(
     IInstanceCleanupQueue cleanupQueue,
     ILogger <JobSubmissionService> logger,
     IJobs jobsApi,
     IPayloads payloadsApi,
     IJobStore jobStore,
     IFileSystem fileSystem)
 {
     _cleanupQueue = cleanupQueue ?? throw new ArgumentNullException(nameof(cleanupQueue));
     _logger       = logger ?? throw new ArgumentNullException(nameof(logger));
     _jobsApi      = jobsApi ?? throw new ArgumentNullException(nameof(jobsApi));
     _payloadsApi  = payloadsApi ?? throw new ArgumentNullException(nameof(payloadsApi));
     _jobStore     = jobStore ?? throw new ArgumentNullException(nameof(jobStore));
     _fileSystem   = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
 }
Example #18
0
        public JobProcessorBase(
            IInstanceStoredNotificationService instanceStoredNotificationService,
            ILoggerFactory loggerFactory,
            IJobs jobsApi,
            IJobStore jobStore,
            IInstanceCleanupQueue cleanupQueue,
            CancellationToken cancellationToken)
        {
            if (loggerFactory is null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _instanceStoredNotificationService = instanceStoredNotificationService ?? throw new ArgumentNullException(nameof(instanceStoredNotificationService));
            _logger             = loggerFactory.CreateLogger <JobProcessorBase>();
            _jobsApi            = jobsApi ?? throw new ArgumentNullException(nameof(jobsApi));
            _jobStore           = jobStore ?? throw new ArgumentNullException(nameof(jobStore));
            _cleanupQueue       = cleanupQueue ?? throw new ArgumentNullException(nameof(cleanupQueue));
            CancellationToken   = cancellationToken;
            _cancelSubscription = _instanceStoredNotificationService.Subscribe(this);
        }
Example #19
0
 /// <summary>
 /// Gets Jobs.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Read.
 ///
 /// Required permissions: Jobs.View.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='mandatoryPermissions'>
 /// If in a cross-folder scenario, these represent the additional permissions
 /// required in the folders the data is retrieved from; all permissions in this
 /// set must be met
 /// </param>
 /// <param name='atLeastOnePermissions'>
 /// If in a cross-folder scenario, these represent the additional permissions
 /// required in the folders the data is retrieved from; at least one permission
 /// in this set must be met
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='filter'>
 /// Restricts the set of items returned. The maximum number of expressions is
 /// 100.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 /// <param name='orderby'>
 /// Specifies the order in which items are returned. The maximum number of
 /// expressions is 5.
 /// </param>
 /// <param name='top'>
 /// Limits the number of items returned from a collection. The maximum value is
 /// 1000.
 /// </param>
 /// <param name='skip'>
 /// Excludes the specified number of items of the queried collection from the
 /// result.
 /// </param>
 /// <param name='count'>
 /// Indicates whether the total count of items within a collection are returned
 /// in the result.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 public static ODataValueOfIEnumerableOfJobDto Get(this IJobs operations, IList <string> mandatoryPermissions = default(IList <string>), IList <string> atLeastOnePermissions = default(IList <string>), string expand = default(string), string filter = default(string), string select = default(string), string orderby = default(string), int?top = default(int?), int?skip = default(int?), bool?count = default(bool?), long?xUIPATHOrganizationUnitId = default(long?))
 {
     return(operations.GetAsync(mandatoryPermissions, atLeastOnePermissions, expand, filter, select, orderby, top, skip, count, xUIPATHOrganizationUnitId).GetAwaiter().GetResult());
 }
Example #20
0
 /// <summary>
 /// Cancels or terminates the specified jobs.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Write.
 ///
 /// Required permissions: Jobs.Edit.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// JobIds - The ids for the jobs to be canceled or terminated;
 /// Strategy - States whether a job should be soft stopped or killed
 /// immediately.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task StopJobsAsync(this IJobs operations, JobsStopJobsParameters body = default(JobsStopJobsParameters), long?xUIPATHOrganizationUnitId = default(long?), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.StopJobsWithHttpMessagesAsync(body, xUIPATHOrganizationUnitId, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Example #21
0
 /// <summary>
 /// Cancels or terminates the specified jobs.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Write.
 ///
 /// Required permissions: Jobs.Edit.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// JobIds - The ids for the jobs to be canceled or terminated;
 /// Strategy - States whether a job should be soft stopped or killed
 /// immediately.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 public static void StopJobs(this IJobs operations, JobsStopJobsParameters body = default(JobsStopJobsParameters), long?xUIPATHOrganizationUnitId = default(long?))
 {
     operations.StopJobsAsync(body, xUIPATHOrganizationUnitId).GetAwaiter().GetResult();
 }
Example #22
0
 /// <summary>
 /// Adds a new job and sets it in Pending state for each robot based on the
 /// input parameters and notifies the respective robots about the pending job.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Write.
 ///
 /// Required permissions: Jobs.Create.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// StartInfo - The information required to register the new jobs.
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='filter'>
 /// Restricts the set of items returned. The maximum number of expressions is
 /// 100.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 /// <param name='orderby'>
 /// Specifies the order in which items are returned. The maximum number of
 /// expressions is 5.
 /// </param>
 /// <param name='count'>
 /// Indicates whether the total count of items within a collection are returned
 /// in the result.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 public static ODataValueOfIEnumerableOfJobDto StartJobs(this IJobs operations, JobsStartJobsParameters body = default(JobsStartJobsParameters), string expand = default(string), string filter = default(string), string select = default(string), string orderby = default(string), bool?count = default(bool?), long?xUIPATHOrganizationUnitId = default(long?))
 {
     return(operations.StartJobsAsync(body, expand, filter, select, orderby, count, xUIPATHOrganizationUnitId).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Cancels or terminates the specified jobs.
 /// </summary>
 /// <remarks>
 /// Required permissions: Jobs.Edit.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='stopJobsParameters'>
 /// JobIds - The ids for the jobs to be canceled or terminated;
 /// Strategy - States whether a job should be soft stopped or killed
 /// immediately.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task StopJobsAsync(this IJobs operations, StopJobsParameters stopJobsParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     (await operations.StopJobsWithHttpMessagesAsync(stopJobsParameters, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Example #24
0
 /// <summary>
 /// Gets a single job.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Read.
 ///
 /// Required permissions: Jobs.View.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='key'>
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 public static JobDto GetById(this IJobs operations, long key, string expand = default(string), string select = default(string), long?xUIPATHOrganizationUnitId = default(long?))
 {
     return(operations.GetByIdAsync(key, expand, select, xUIPATHOrganizationUnitId).GetAwaiter().GetResult());
 }
Example #25
0
        private async Task ProcessNextJob(IJobRepository repository, IJobs jobsApi, CancellationToken cancellationToken)
        {
            InferenceJob       job    = null;
            InferenceJobStatus status = InferenceJobStatus.Fail;

            try
            {
                _logger.Log(LogLevel.Debug, $"Waiting for new job...");
                job = await repository.Take(cancellationToken);

                using (_logger.BeginScope(new LogginDataDictionary <string, object> {
                    { "JobId", job.JobId }, { "PayloadId", job.PayloadId }
                }))
                {
                    switch (job.State)
                    {
                    case InferenceJobState.Creating:
                        await CreateJob(job);

                        break;

                    case InferenceJobState.MetadataUploading:
                        await UploadMetadata(job);

                        break;

                    case InferenceJobState.PayloadUploading:
                        await UploadFiles(job, job.JobPayloadsStoragePath);

                        break;

                    case InferenceJobState.Starting:
                        await jobsApi.Start(job);

                        break;

                    default:
                        throw new InvalidOperationException($"Unsupported job state {job.State}.");
                    }
                    status = InferenceJobStatus.Success;
                }
            }
            catch (OperationCanceledException ex)
            {
                _logger.Log(LogLevel.Warning, ex, "Job Store Service canceled: {0}");
            }
            catch (InvalidOperationException ex)
            {
                _logger.Log(LogLevel.Warning, ex, "Job Store Service may be disposed or Jobs API returned an error: {0}");
            }
            catch (PayloadUploadException ex)
            {
                _logger.Log(LogLevel.Error, ex, ex.Message);
            }
            catch (Exception ex)
            {
                _logger.Log(LogLevel.Error, ex, "Error communicating with Clara Platform.");
            }
            finally
            {
                if (job != null)
                {
                    try
                    {
                        var updatedJob = await repository.TransitionState(job, status, cancellationToken);

                        if (updatedJob.State == InferenceJobState.Completed ||
                            updatedJob.State == InferenceJobState.Faulted)
                        {
                            CleanupJobFiles(updatedJob);
                        }
                    }
                    catch (Exception ex)
                    {
                        _logger.Log(LogLevel.Error, ex, "Error while transitioning job state.");
                    }
                }
            }
        }
 public StopJobsButton(IJobs jobs, IMessageBox messageBox)
 {
     this.jobs       = jobs;
     this.messageBox = messageBox;
 }
 /// <summary>
 /// Gets Jobs.
 /// </summary>
 /// <remarks>
 /// Required permissions: Jobs.View.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='expand'>
 /// Expands related entities inline.
 /// </param>
 /// <param name='filter'>
 /// Filters the results, based on a Boolean condition.
 /// </param>
 /// <param name='select'>
 /// Selects which properties to include in the response.
 /// </param>
 /// <param name='orderby'>
 /// Sorts the results.
 /// </param>
 /// <param name='top'>
 /// Returns only the first n results.
 /// </param>
 /// <param name='skip'>
 /// Skips the first n results.
 /// </param>
 /// <param name='count'>
 /// Includes a count of the matching results in the response.
 /// </param>
 public static ODataResponseListJobDto GetJobs(this IJobs operations, string expand = default(string), string filter = default(string), string select = default(string), string orderby = default(string), int?top = default(int?), int?skip = default(int?), bool?count = default(bool?))
 {
     return(operations.GetJobsAsync(expand, filter, select, orderby, top, skip, count).GetAwaiter().GetResult());
 }
 /// <param name="jobs">
 /// All long-running jobs.
 /// </param>
 public JobsController(IJobs jobs) => this.jobs = jobs;
Example #29
0
 /// <summary>
 /// Resumes the specified job.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Jobs or Jobs.Write.
 ///
 /// Required permissions: Jobs.Edit.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// The specified job key.
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 /// <param name='xUIPATHOrganizationUnitId'>
 /// Folder/OrganizationUnit Id
 /// </param>
 public static JobDto ResumeJob(this IJobs operations, JobsResumeJobParameters body = default(JobsResumeJobParameters), string expand = default(string), string select = default(string), long?xUIPATHOrganizationUnitId = default(long?))
 {
     return(operations.ResumeJobAsync(body, expand, select, xUIPATHOrganizationUnitId).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Cancels or terminates the specified jobs.
 /// </summary>
 /// <remarks>
 /// Required permissions: Jobs.Edit.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='stopJobsParameters'>
 /// JobIds - The ids for the jobs to be canceled or terminated;
 /// Strategy - States whether a job should be soft stopped or killed
 /// immediately.
 /// </param>
 public static void StopJobs(this IJobs operations, StopJobsParameters stopJobsParameters)
 {
     operations.StopJobsAsync(stopJobsParameters).GetAwaiter().GetResult();
 }