Skip to content

Commit

Permalink
deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
aamend committed Mar 8, 2024
1 parent f3aabde commit e4c647b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 31 deletions.
27 changes: 1 addition & 26 deletions databricks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from databricks.accelerator import Accelerator
import os
import logging
import sys
import argparse
Expand All @@ -19,31 +18,7 @@

args = parser.parse_args()


'''
name: databricks-web-files
path: notebooks/{vertical}/{solution_codename}/{file_name}
link: https://databricks-web-files.s3.us-east-2.amazonaws.com/notebooks
'''


s3_bucket = 'databricks-web-files'
s3_path = 'notebooks/{solution_codename}/{file_name}'
s3_link = 'https://databricks-web-files.s3.us-east-2.amazonaws.com/notebooks'
s3_access_key = os.environ['AWS_ACCESS_KEY']
s3_secret_key = os.environ['AWS_ACCESS_SECRET']

db_host = os.environ['DB_HOST']
db_token = os.environ['DB_TOKEN']



accelerator = Accelerator()

accelerator.release(
Accelerator().release(
db_path=args.path,
db_name=args.name
)

s3_host = os.environ['AWS_ACCESS_KEY']
s3_key = os.environ['AWS_ACCESS_SECRET']
9 changes: 4 additions & 5 deletions databricks/accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,13 @@ def deploy_s3(self, files, solution_codename):
ContentType='text/html'
)

def release(self, db_path, db_name, deploy: False):
def release(self, db_path, db_name):
output_dir = 'site'
if os.path.exists(output_dir):
shutil.rmtree(output_dir)
os.makedirs(output_dir)
self.logger.info(f"Releasing solution [{db_name}]")
self.export_to_html(db_path, output_dir, db_name)
if deploy:
files = os.listdir(output_dir)
self.deploy_s3(["{}/{}".format(output_dir, file) for file in files], db_name)
self.logger.info(f"Solution deployed to [{self.s3_link}/{db_name}/index.html]")
files = os.listdir(output_dir)
self.deploy_s3(["{}/{}".format(output_dir, file) for file in files], db_name)
self.logger.info(f"Solution deployed to [{self.s3_link}/{db_name}/index.html]")
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
databricks-api==0.9.0
boto3==1.34.58
wheel==0.37.1
semver==2.13.0

0 comments on commit e4c647b

Please sign in to comment.