-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
491 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
core/src/main/scala/com/databricks/labs/remorph/intermediate/workflows/jobs/Job.scala
This file was deleted.
Oops, something went wrong.
11 changes: 5 additions & 6 deletions
11
core/src/main/scala/com/databricks/labs/remorph/intermediate/workflows/jobs/JobCluster.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
package com.databricks.labs.remorph.intermediate.workflows.jobs | ||
|
||
import com.databricks.labs.remorph.intermediate.workflows.JobNode | ||
import com.databricks.labs.remorph.intermediate.workflows.clusters.ClusterSpec | ||
import com.databricks.labs.remorph.intermediate.workflows.clusters.NewClusterSpec | ||
import com.databricks.sdk.service.jobs | ||
|
||
case class JobCluster(jobClusterKey: String, newCluster: ClusterSpec) extends JobNode { | ||
case class JobCluster(jobClusterKey: String, newCluster: NewClusterSpec) extends JobNode { | ||
override def children: Seq[JobNode] = Seq(newCluster) | ||
def toSDK: jobs.JobCluster = { | ||
val raw = new jobs.JobCluster() | ||
raw | ||
} | ||
def toSDK: jobs.JobCluster = new jobs.JobCluster() | ||
.setJobClusterKey(jobClusterKey) | ||
.setNewCluster(newCluster.toSDK) | ||
} |
13 changes: 0 additions & 13 deletions
13
...rc/main/scala/com/databricks/labs/remorph/intermediate/workflows/jobs/JobDeployment.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 55 additions & 25 deletions
80
.../src/main/scala/com/databricks/labs/remorph/intermediate/workflows/jobs/JobSettings.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,71 @@ | ||
package com.databricks.labs.remorph.intermediate.workflows.jobs | ||
|
||
import scala.collection.JavaConverters._ | ||
import com.databricks.labs.remorph.intermediate.workflows.schedules.{Continuous, CronSchedule, TriggerSettings} | ||
import com.databricks.labs.remorph.intermediate.workflows.sources.GitSource | ||
import com.databricks.labs.remorph.intermediate.workflows.tasks.Task | ||
import com.databricks.labs.remorph.intermediate.workflows.JobNode | ||
import com.databricks.labs.remorph.intermediate.workflows.webhooks.WebhookNotifications | ||
import com.databricks.sdk.service.jobs | ||
import com.databricks.sdk.service.jobs.{Format, JobEditMode} | ||
|
||
case class JobSettings( | ||
budgetPolicyId: Option[String] = None, | ||
continuous: Option[Continuous] = None, | ||
deployment: Option[JobDeployment] = None, | ||
name: String, | ||
tasks: Seq[Task], | ||
tags: Map[String, String] = Map.empty, | ||
description: Option[String] = None, | ||
editMode: Option[JobEditMode] = None, | ||
emailNotifications: Option[JobEmailNotifications] = None, | ||
environments: Seq[JobEnvironment] = Seq.empty, | ||
format: Option[Format] = None, | ||
gitSource: Option[GitSource] = None, | ||
health: Option[JobsHealthRules] = None, | ||
jobClusters: Seq[JobCluster] = Seq.empty, | ||
maxConcurrentRuns: Option[Int] = None, | ||
name: Option[String] = None, | ||
notificationSettings: Option[JobNotificationSettings] = None, | ||
parameters: Seq[JobParameterDefinition] = Seq.empty, | ||
runAs: Option[JobRunAs] = None, | ||
jobClusters: Seq[JobCluster] = Seq.empty, | ||
continuous: Option[Continuous] = None, | ||
schedule: Option[CronSchedule] = None, | ||
tags: Option[Map[String, String]] = None, | ||
tasks: Seq[Task] = Seq.empty, | ||
timeoutSeconds: Option[Int] = None, | ||
trigger: Option[TriggerSettings] = None, | ||
environments: Seq[JobEnvironment] = Seq.empty, | ||
health: Option[JobsHealthRules] = None, | ||
timeoutSeconds: Option[Long] = None, | ||
maxConcurrentRuns: Option[Long] = None, | ||
runAs: Option[JobRunAs] = None, | ||
emailNotifications: Option[JobEmailNotifications] = None, | ||
notificationSettings: Option[JobNotificationSettings] = None, | ||
webhookNotifications: Option[WebhookNotifications] = None) | ||
extends JobNode { | ||
override def children: Seq[JobNode] = Seq() ++ continuous ++ deployment ++ emailNotifications ++ | ||
gitSource ++ health ++ notificationSettings ++ runAs ++ schedule ++ trigger ++ webhookNotifications | ||
def toSDK: jobs.JobSettings = { | ||
val raw = new jobs.JobSettings() | ||
raw | ||
} | ||
override def children: Seq[JobNode] = Seq() ++ continuous ++ emailNotifications ++ | ||
health ++ notificationSettings ++ runAs ++ schedule ++ trigger ++ webhookNotifications | ||
|
||
def toUpdate: jobs.JobSettings = new jobs.JobSettings() | ||
.setContinuous(continuous.map(_.toSDK).orNull) | ||
.setDescription(description.orNull) | ||
.setEmailNotifications(emailNotifications.map(_.toSDK).orNull) | ||
.setEnvironments(environments.map(_.toSDK).asJava) | ||
.setFormat(jobs.Format.MULTI_TASK) | ||
.setHealth(health.map(_.toSDK).orNull) | ||
.setJobClusters(jobClusters.map(_.toSDK).asJava) | ||
// .setMaxConcurrentRuns(maxConcurrentRuns.orNull) | ||
.setName(name) | ||
.setNotificationSettings(notificationSettings.map(_.toSDK).orNull) | ||
.setParameters(parameters.map(_.toSDK).asJava) | ||
.setRunAs(runAs.map(_.toSDK).orNull) | ||
.setSchedule(schedule.map(_.toSDK).orNull) | ||
.setTags(tags.asJava) | ||
.setTasks(tasks.map(_.toSDK).asJava) | ||
// .setTimeoutSeconds(timeoutSeconds.orNull) | ||
.setTrigger(trigger.map(_.toSDK).orNull) | ||
.setWebhookNotifications(webhookNotifications.map(_.toSDK).orNull) | ||
|
||
def toCreate: jobs.CreateJob = new jobs.CreateJob() | ||
.setContinuous(continuous.map(_.toSDK).orNull) | ||
.setDescription(description.orNull) | ||
.setEmailNotifications(emailNotifications.map(_.toSDK).orNull) | ||
.setEnvironments(environments.map(_.toSDK).asJava) | ||
.setFormat(jobs.Format.MULTI_TASK) | ||
.setHealth(health.map(_.toSDK).orNull) | ||
.setJobClusters(jobClusters.map(_.toSDK).asJava) | ||
// .setMaxConcurrentRuns(maxConcurrentRuns.orNull) | ||
.setName(name) | ||
.setNotificationSettings(notificationSettings.map(_.toSDK).orNull) | ||
.setParameters(parameters.map(_.toSDK).asJava) | ||
.setRunAs(runAs.map(_.toSDK).orNull) | ||
.setSchedule(schedule.map(_.toSDK).orNull) | ||
.setTags(tags.asJava) | ||
.setTasks(tasks.map(_.toSDK).asJava) | ||
// .setTimeoutSeconds(timeoutSeconds.orNull) | ||
.setTrigger(trigger.map(_.toSDK).orNull) | ||
.setWebhookNotifications(webhookNotifications.map(_.toSDK).orNull) | ||
} |
10 changes: 3 additions & 7 deletions
10
...c/main/scala/com/databricks/labs/remorph/intermediate/workflows/jobs/JobsHealthRule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
package com.databricks.labs.remorph.intermediate.workflows.jobs | ||
|
||
import com.databricks.labs.remorph.intermediate.workflows.JobNode | ||
import com.databricks.labs.remorph.intermediate.workflows.LeafJobNode | ||
import com.databricks.sdk.service.jobs | ||
import com.databricks.sdk.service.jobs.{JobsHealthMetric, JobsHealthOperator} | ||
|
||
case class JobsHealthRule(metric: JobsHealthMetric, op: JobsHealthOperator, value: Int) extends JobNode { | ||
override def children: Seq[JobNode] = Seq() | ||
def toSDK: jobs.JobsHealthRule = { | ||
val raw = new jobs.JobsHealthRule() | ||
raw | ||
} | ||
case class JobsHealthRule(metric: JobsHealthMetric, op: JobsHealthOperator, value: Int) extends LeafJobNode { | ||
def toSDK: jobs.JobsHealthRule = new jobs.JobsHealthRule().setMetric(metric).setOp(op).setValue(value) | ||
} |
8 changes: 3 additions & 5 deletions
8
.../main/scala/com/databricks/labs/remorph/intermediate/workflows/jobs/JobsHealthRules.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
package com.databricks.labs.remorph.intermediate.workflows.jobs | ||
|
||
import scala.collection.JavaConverters._ | ||
import com.databricks.labs.remorph.intermediate.workflows.JobNode | ||
import com.databricks.sdk.service.jobs | ||
|
||
case class JobsHealthRules(rules: Seq[JobsHealthRule] = Seq.empty) extends JobNode { | ||
case class JobsHealthRules(rules: Seq[JobsHealthRule]) extends JobNode { | ||
override def children: Seq[JobNode] = rules | ||
def toSDK: jobs.JobsHealthRules = { | ||
val raw = new jobs.JobsHealthRules() | ||
raw | ||
} | ||
def toSDK: jobs.JobsHealthRules = new jobs.JobsHealthRules().setRules(rules.map(_.toSDK).asJava) | ||
} |
11 changes: 4 additions & 7 deletions
11
...main/scala/com/databricks/labs/remorph/intermediate/workflows/libraries/Environment.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
package com.databricks.labs.remorph.intermediate.workflows.libraries | ||
|
||
import com.databricks.labs.remorph.intermediate.workflows.JobNode | ||
import scala.collection.JavaConverters._ | ||
import com.databricks.labs.remorph.intermediate.workflows.LeafJobNode | ||
import com.databricks.sdk.service.compute | ||
|
||
case class Environment(client: String, dependencies: Seq[String] = Seq.empty) extends JobNode { | ||
override def children: Seq[JobNode] = Seq() | ||
def toSDK: compute.Environment = { | ||
val raw = new compute.Environment() | ||
raw | ||
} | ||
case class Environment(client: String, dependencies: Seq[String] = Seq.empty) extends LeafJobNode { | ||
def toSDK: compute.Environment = new compute.Environment().setClient(client).setDependencies(dependencies.asJava) | ||
} |
Oops, something went wrong.