Skip to content

Commit

Permalink
Merge pull request #23 from intelematics/fix/issue19-hardcoded-path
Browse files Browse the repository at this point in the history
Fix/issue19 hardcoded path
  • Loading branch information
stephanie-mak committed Sep 2, 2021
2 parents 3df204f + 2fcf82c commit bd3a650
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bricklayer/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.9'
__version__ = '0.0.10'
9 changes: 4 additions & 5 deletions bricklayer/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,17 @@ def mkdir(self, dir_path):
)
)

def backup_notebook(self, source_path, target_path, fmt="DBC"):
def backup_notebook(self, source_path, target_path, tmp_dir, fmt="DBC"):
"Backup a notebook to another place in the workspace"
tmp_dir = '/dbfs/tmp/'
tmp_name = 'backup'
tmp_name = f'backup_{random.randint(0,1000)}'
intermediate_location = pathlib.Path(tmp_dir).joinpath(tmp_name)
self.export_notebook(source_path, intermediate_location.as_posix(), fmt)
try:
self.import_notebook(intermediate_location, target_path, fmt)
finally:
intermediate_location.unlink()

def export_current_notebook_run(self, target_path, fmt="DBC"):
def export_current_notebook_run(self, target_path, tmp_dir, fmt="DBC"):
"""Save the current notebook to a given location in the required format (default DBC)
and preserving the path and timestamp.
Formats allowed:
Expand All @@ -189,7 +188,7 @@ def export_current_notebook_run(self, target_path, fmt="DBC"):
.joinpath(timestamp)
)
try:
self.backup_notebook(current_path, target_path.as_posix(), fmt)
self.backup_notebook(current_path, target_path.as_posix(), tmp_dir, fmt)
except requests.exceptions.HTTPError as _e:
error_code = _e.response.json()['error_code']
if error_code == 'RESOURCE_DOES_NOT_EXIST':
Expand Down
Binary file added examples/wiki1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/wiki2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bd3a650

Please sign in to comment.