forked from AeshanTechHub/DatabrickWorkflowExamplePythonSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
45 lines (32 loc) · 1.24 KB
/
Copy pathmain.py
File metadata and controls
45 lines (32 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Databricks notebook source
# DBTITLE 1,Install Dependant Libraries
!cp ./requirements.txt ~/.
%pip install -r ~/requirements.txt
# COMMAND ----------
# DBTITLE 1,Restart the kernel
dbutils.library.restartPython()
# COMMAND ----------
# DBTITLE 1,Import Libraries
import os
# COMMAND ----------
# DBTITLE 1,Setup the root path
notebook_path = dbutils.notebook.entry_point.getDbutils().notebook().getContext().notebookPath().get()
repo_root = os.path.dirname(notebook_path)
os.chdir(f"/Workspace/{repo_root}/")
%pwd
# COMMAND ----------
# DBTITLE 1,Import modules
from src.create_workflow_jobs import *
# COMMAND ----------
# DBTITLE 1,Configurations
job_name = 'Add your job name here'
job_timeout_seconds = 'Add the timeout in seconds here (integer type)'
max_concurrent_runs = 'Add the max concurrent runs here (integer type)'
cluster_id = 'Add the existing cluster id here'
notebook_path = 'Add the notebook path here'
cron_schedule = 'Add the cron schedule syntax here'
timezone = 'Add the timezone here'
# COMMAND ----------
# DBTITLE 1,Create jobs in workflow - Pass the Parameters
create_jobs = CreateWorkflowJobs(job_name, job_timeout_seconds, max_concurrent_runs, cluster_id, notebook_path, cron_schedule, timezone)
create_jobs.create_workflow_jobs()