internal ComputeJobBase(JobType jobType, JobBaseInteractionEndpoints interactionEndpoints, string description, IDictionary <string, string> tags, IDictionary <string, string> properties, string experimentName, ComputeBinding computeBinding, JobOutput output) : base(jobType, interactionEndpoints, description, tags, properties) { ExperimentName = experimentName; ComputeBinding = computeBinding; Output = output; JobType = jobType; }
public ComputeJobBase(ComputeBinding computeBinding) { if (computeBinding == null) { throw new ArgumentNullException(nameof(computeBinding)); } ComputeBinding = computeBinding; JobType = new JobType("ComputeJobBase"); }
public CommandJob(ComputeBinding computeBinding, CodeConfiguration codeConfiguration) : base(computeBinding) { if (computeBinding == null) { throw new ArgumentNullException(nameof(computeBinding)); } if (codeConfiguration == null) { throw new ArgumentNullException(nameof(codeConfiguration)); } CodeConfiguration = codeConfiguration; DataBindings = new ChangeTrackingDictionary <string, DataBinding>(); JobType = JobType.Command; }
public SweepJob(ComputeBinding computeBinding, ParameterSamplingConfiguration parameterSamplingConfiguration, EvaluationConfiguration evaluationConfiguration) : base(computeBinding) { if (computeBinding == null) { throw new ArgumentNullException(nameof(computeBinding)); } if (parameterSamplingConfiguration == null) { throw new ArgumentNullException(nameof(parameterSamplingConfiguration)); } if (evaluationConfiguration == null) { throw new ArgumentNullException(nameof(evaluationConfiguration)); } ParameterSamplingConfiguration = parameterSamplingConfiguration; EvaluationConfiguration = evaluationConfiguration; JobType = JobType.Sweep; }
internal static MLAssistConfiguration DeserializeMLAssistConfiguration(JsonElement element) { Optional <ComputeBinding> inferencingComputeBinding = default; Optional <ComputeBinding> trainingComputeBinding = default; Optional <bool> mlAssistEnabled = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("inferencingComputeBinding")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } inferencingComputeBinding = ComputeBinding.DeserializeComputeBinding(property.Value); continue; } if (property.NameEquals("trainingComputeBinding")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } trainingComputeBinding = ComputeBinding.DeserializeComputeBinding(property.Value); continue; } if (property.NameEquals("mlAssistEnabled")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } mlAssistEnabled = property.Value.GetBoolean(); continue; } } return(new MLAssistConfiguration(inferencingComputeBinding.Value, trainingComputeBinding.Value, Optional.ToNullable(mlAssistEnabled))); }
internal static ComputeJobBase DeserializeComputeJobBase(JsonElement element) { if (element.TryGetProperty("jobType", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "Command": return(CommandJob.DeserializeCommandJob(element)); case "Sweep": return(SweepJob.DeserializeSweepJob(element)); } } Optional <string> experimentName = default; ComputeBinding computeBinding = default; Optional <JobOutput> output = default; JobType jobType = default; Optional <JobBaseInteractionEndpoints> interactionEndpoints = default; Optional <string> description = default; Optional <IDictionary <string, string> > tags = default; Optional <IDictionary <string, string> > properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("experimentName")) { experimentName = property.Value.GetString(); continue; } if (property.NameEquals("computeBinding")) { computeBinding = ComputeBinding.DeserializeComputeBinding(property.Value); continue; } if (property.NameEquals("output")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } output = JobOutput.DeserializeJobOutput(property.Value); continue; } if (property.NameEquals("jobType")) { jobType = new JobType(property.Value.GetString()); continue; } if (property.NameEquals("interactionEndpoints")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } interactionEndpoints = JobBaseInteractionEndpoints.DeserializeJobBaseInteractionEndpoints(property.Value); continue; } if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } properties = dictionary; continue; } } return(new ComputeJobBase(jobType, interactionEndpoints.Value, description.Value, Optional.ToDictionary(tags), Optional.ToDictionary(properties), experimentName.Value, computeBinding, output.Value)); }
internal static SweepJob DeserializeSweepJob(JsonElement element) { Optional <JobStatus> status = default; ParameterSamplingConfiguration parameterSamplingConfiguration = default; Optional <TerminationConfiguration> terminationConfiguration = default; EvaluationConfiguration evaluationConfiguration = default; Optional <TrialComponent> trialComponent = default; Optional <string> experimentName = default; ComputeBinding computeBinding = default; Optional <JobOutput> output = default; JobType jobType = default; Optional <JobBaseInteractionEndpoints> interactionEndpoints = default; Optional <string> description = default; Optional <IDictionary <string, string> > tags = default; Optional <IDictionary <string, string> > properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } status = new JobStatus(property.Value.GetString()); continue; } if (property.NameEquals("parameterSamplingConfiguration")) { parameterSamplingConfiguration = ParameterSamplingConfiguration.DeserializeParameterSamplingConfiguration(property.Value); continue; } if (property.NameEquals("terminationConfiguration")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } terminationConfiguration = TerminationConfiguration.DeserializeTerminationConfiguration(property.Value); continue; } if (property.NameEquals("evaluationConfiguration")) { evaluationConfiguration = EvaluationConfiguration.DeserializeEvaluationConfiguration(property.Value); continue; } if (property.NameEquals("trialComponent")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } trialComponent = TrialComponent.DeserializeTrialComponent(property.Value); continue; } if (property.NameEquals("experimentName")) { experimentName = property.Value.GetString(); continue; } if (property.NameEquals("computeBinding")) { computeBinding = ComputeBinding.DeserializeComputeBinding(property.Value); continue; } if (property.NameEquals("output")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } output = JobOutput.DeserializeJobOutput(property.Value); continue; } if (property.NameEquals("jobType")) { jobType = new JobType(property.Value.GetString()); continue; } if (property.NameEquals("interactionEndpoints")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } interactionEndpoints = JobBaseInteractionEndpoints.DeserializeJobBaseInteractionEndpoints(property.Value); continue; } if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } properties = dictionary; continue; } } return(new SweepJob(jobType, interactionEndpoints.Value, description.Value, Optional.ToDictionary(tags), Optional.ToDictionary(properties), experimentName.Value, computeBinding, output.Value, Optional.ToNullable(status), parameterSamplingConfiguration, terminationConfiguration.Value, evaluationConfiguration, trialComponent.Value)); }
internal CommandJob(JobType jobType, JobBaseInteractionEndpoints interactionEndpoints, string description, IDictionary <string, string> tags, IDictionary <string, string> properties, string experimentName, ComputeBinding computeBinding, JobOutput output, JobStatus?status, long?maxRunDurationSeconds, CodeConfiguration codeConfiguration, string environmentId, IDictionary <string, DataBinding> dataBindings, DistributionConfiguration distributionConfiguration) : base(jobType, interactionEndpoints, description, tags, properties, experimentName, computeBinding, output) { Status = status; MaxRunDurationSeconds = maxRunDurationSeconds; CodeConfiguration = codeConfiguration; EnvironmentId = environmentId; DataBindings = dataBindings; DistributionConfiguration = distributionConfiguration; JobType = jobType; }
internal static CommandJob DeserializeCommandJob(JsonElement element) { Optional <JobStatus> status = default; Optional <long> maxRunDurationSeconds = default; CodeConfiguration codeConfiguration = default; Optional <string> environmentId = default; Optional <IDictionary <string, DataBinding> > dataBindings = default; Optional <DistributionConfiguration> distributionConfiguration = default; Optional <string> experimentName = default; ComputeBinding computeBinding = default; Optional <JobOutput> output = default; JobType jobType = default; Optional <JobBaseInteractionEndpoints> interactionEndpoints = default; Optional <string> description = default; Optional <IDictionary <string, string> > tags = default; Optional <IDictionary <string, string> > properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } status = new JobStatus(property.Value.GetString()); continue; } if (property.NameEquals("maxRunDurationSeconds")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } maxRunDurationSeconds = property.Value.GetInt64(); continue; } if (property.NameEquals("codeConfiguration")) { codeConfiguration = CodeConfiguration.DeserializeCodeConfiguration(property.Value); continue; } if (property.NameEquals("environmentId")) { environmentId = property.Value.GetString(); continue; } if (property.NameEquals("dataBindings")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, DataBinding> dictionary = new Dictionary <string, DataBinding>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, DataBinding.DeserializeDataBinding(property0.Value)); } dataBindings = dictionary; continue; } if (property.NameEquals("distributionConfiguration")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } distributionConfiguration = DistributionConfiguration.DeserializeDistributionConfiguration(property.Value); continue; } if (property.NameEquals("experimentName")) { experimentName = property.Value.GetString(); continue; } if (property.NameEquals("computeBinding")) { computeBinding = ComputeBinding.DeserializeComputeBinding(property.Value); continue; } if (property.NameEquals("output")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } output = JobOutput.DeserializeJobOutput(property.Value); continue; } if (property.NameEquals("jobType")) { jobType = new JobType(property.Value.GetString()); continue; } if (property.NameEquals("interactionEndpoints")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } interactionEndpoints = JobBaseInteractionEndpoints.DeserializeJobBaseInteractionEndpoints(property.Value); continue; } if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } properties = dictionary; continue; } } return(new CommandJob(jobType, interactionEndpoints.Value, description.Value, Optional.ToDictionary(tags), Optional.ToDictionary(properties), experimentName.Value, computeBinding, output.Value, Optional.ToNullable(status), Optional.ToNullable(maxRunDurationSeconds), codeConfiguration, environmentId.Value, Optional.ToDictionary(dataBindings), distributionConfiguration.Value)); }
internal SweepJob(JobType jobType, JobBaseInteractionEndpoints interactionEndpoints, string description, IDictionary <string, string> tags, IDictionary <string, string> properties, string experimentName, ComputeBinding computeBinding, JobOutput output, JobStatus?status, ParameterSamplingConfiguration parameterSamplingConfiguration, TerminationConfiguration terminationConfiguration, EvaluationConfiguration evaluationConfiguration, TrialComponent trialComponent) : base(jobType, interactionEndpoints, description, tags, properties, experimentName, computeBinding, output) { Status = status; ParameterSamplingConfiguration = parameterSamplingConfiguration; TerminationConfiguration = terminationConfiguration; EvaluationConfiguration = evaluationConfiguration; TrialComponent = trialComponent; JobType = jobType; }