Skip to content

Commit

Permalink
Rename dags when projectid is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
hayssams committed Jan 8, 2025
1 parent 7e8565a commit c8d428d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ object DagGenerateCmd extends Cmd[DagGenerateConfig] {
cmd.generateDomainDags(config)
cmd.generateTaskDags(config)
}
cmd.normalizeDagNames(config)
JobResult.empty
}
result
Expand Down
25 changes: 25 additions & 0 deletions src/main/scala/ai/starlake/schema/generator/DagGenerateJob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,31 @@ class DagGenerateJob(schemaHandler: SchemaHandler) extends LazyLogging {
}
groupDagConfigNameAndSchedule
}

def normalizeDagNames(config: DagGenerateConfig)(implicit settings: Settings) = {
config.projectId match {
case Some(projectId) =>
val outputDir = new Path(
config.outputDir.getOrElse(throw new Exception("outputDir is required"))
)
val dagFiles =
settings
.storageHandler()
.list(
path = outputDir,
extension = ".py",
exclude = Some("_.*".r.pattern),
recursive = false
)
dagFiles.foreach { file =>
val fileName = file.path.getName
val newFileName = s"SL_${projectId}_$fileName"
settings.storageHandler().move(file.path, new Path(file.path.getParent, newFileName))
}
case None =>

}
}
}

object DagGenerateJob {
Expand Down
8 changes: 4 additions & 4 deletions tmpsbt.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sbt ++2.13 assembly
cp $HOME/git/public/starlake/target/scala-2.13/starlake-core_2.13-1.3.1-SNAPSHOT-assembly.jar $HOME/starlake/bin/sl/
cp $HOME/git/public/starlake/target/scala-2.13/starlake-core_2.13-1.3.1-SNAPSHOT-assembly.jar $HOME/starlake-app/bin/sl/
cp $HOME/git/public/starlake/target/scala-2.13/starlake-core_2.13-1.3.1-SNAPSHOT-assembly.jar $HOME/git/starlake-api/lib/
cp $HOME/git/public/starlake/target/scala-2.13/starlake-core_2.13-1.3.1-SNAPSHOT-assembly.jar $HOME/git/starlake-api/tmpbuild/starlake/bin/sl/
cp $HOME/git/public/starlake/target/scala-2.13/starlake-core_2.13-${LOCAL_STARLAKE_VERSION}-assembly.jar $HOME/starlake/bin/sl/
cp $HOME/git/public/starlake/target/scala-2.13/starlake-core_2.13-${LOCAL_STARLAKE_VERSION}-assembly.jar $HOME/starlake-app/bin/sl/
cp $HOME/git/public/starlake/target/scala-2.13/starlake-core_2.13-${LOCAL_STARLAKE_VERSION}-assembly.jar $HOME/git/starlake-api/lib/
cp $HOME/git/public/starlake/target/scala-2.13/starlake-core_2.13-${LOCAL_STARLAKE_VERSION}-assembly.jar $HOME/git/starlake-api/tmpbuild/starlake/bin/sl/

0 comments on commit c8d428d

Please sign in to comment.