Skip to content

Commit

Permalink
#813 JobStartArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
zhabis committed Dec 30, 2022
1 parent 48f3622 commit e21b766
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 23 deletions.
37 changes: 15 additions & 22 deletions src/Azos.Sky/Jobs/Intfs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,28 @@

using Azos.Apps;
using Azos.Data;
using Azos.Data.Business;

namespace Azos.Sky.Jobs
{
/// <summary>
/// Performs job management tasks such as starting and querying jobs, sending signals etc.
/// </summary>
public interface IJobManager
{
void AllocJobId();
/// <summary>
/// Reserves a job id by runspace.
/// You may need to know JobIds before you start them, e.g. you may need
/// to pass future JobId into another data structure, and if it fails, abort creating a job
/// </summary>
JobId AllocateJobId(Atom runspace);// sys-log:0:8:43647826346

// Task<JobId> StartJob(JobStartArgs args)
// Task<JobInfo> QueryJob(JobQueryArgs args)

// Task<JobId> SendSignal(Signal signal)
// Task<JobInfo> StartJobAsync(JobStartArgs args);

// Task<IEnumerable<JobInfo>> GetJobListAsync(JobFilter args);

// Task<JobInfo> SendSignalAsync(JobId idJob, Signal signal);
}

public interface IJobManagerLogic : IJobManager, IModuleImplementation
Expand All @@ -43,22 +54,4 @@ public interface IWorkManager
}



public class JobStartArgs
{
[Field(Description = "Uniquely identifies the type of process image which backs this job execution. " +
"In CLR runtime, this maps to a descendant type of a `Job` class via BIX mapping")]
public Guid ProcessImage { get; set; }


[Field(Description = "Optionally, ensures sequential processing of jobs within the same strand, that is:" +
" no more than a single job instance of the same strand ever executes in the system origin (cloud partition) concurrently." +
"Strands can only be defined at job start and are afterwards immutable")]
public string Strand { get; set; }

//tags are immutable once job is launched - see adlib/formflow
//public tag[] Tags
}


}
3 changes: 2 additions & 1 deletion src/Azos.Sky/Jobs/JobParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
using System.Text;

using Azos.Data;
using Azos.Data.Business;
using Azos.Serialization.Bix;
using Azos.Serialization.JSON;

namespace Azos.Sky.Jobs
{
[Schema(Description="Immutable bag of values supplied at the job creation")]
[BixJsonHandler(ThrowOnUnresolvedType = true)]
public abstract class JobParameters : AmorphousTypedDoc
public abstract class JobParameters : TransientModel
{
public override bool AmorphousDataEnabled => true;

Expand Down
59 changes: 59 additions & 0 deletions src/Azos.Sky/Jobs/JobStartArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Text;
/*<FILE_LICENSE>
* Azos (A to Z Application Operating System) Framework
* The A to Z Foundation (a.k.a. Azist) licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
</FILE_LICENSE>*/

using System.Threading.Tasks;

using Azos.Apps;
using Azos.Data;
using Azos.Data.Business;
using Azos.Serialization.Bix;

namespace Azos.Sky.Jobs
{
[Schema(Description = "Job start arguments")]
[Bix("ac1affba-5829-4e13-a3fc-1334b8828644")]
public sealed class JobStartArgs : TransientModel
{
public const int MAX_TAG_COUNT = 32;
public const int MAX_STRAND_LEN = 250;

[Field(Required = true,
Description = "Unique JobId obtained from a call to `AllocateJobId()`. This job must not have started yet")]
public JobId JobId { get; set; }

[Field(Required = true,
Description = "Uniquely identifies the type of process image which backs this job execution. " +
"In CLR runtime, this maps to a descendant type of a `Job` class via BIX mapping")]
public Guid ImageTypeId { get; set; }


[Field(Required = false,
MaxLength = MAX_STRAND_LEN,
Description = "Optionally, ensures sequential processing of jobs within the same strand, that is:" +
" no more than a single job instance of the same strand ever executes in the system origin (cloud partition) concurrently." +
"Strands can only be defined at job start and are afterwards immutable")]
public string Strand { get; set; }


[Field(Required = false, Description = "When is the job scheduled to start execution, if null then job runs asap")]
public DateTime? ScheduledStartUtc { get; set; }


[Field(Required = true,
Description = "Job start parameters. These values are immutable for the lifetime of a job instance " +
"(not to be confused with Job state which IS mutable)")]
public JobParameters Parameters{ get; set; }

/// <summary>
/// Indexable tags used for future flow item searches
/// </summary>
[Field(required: true, maxLength: MAX_TAG_COUNT, Description = "Indexable tags used for future job searches")]
public List<Data.Adlib.Tag> Tags { get; set; }
}
}

0 comments on commit e21b766

Please sign in to comment.