Skip to content

Commit

Permalink
Merge pull request #4 from jullianoacqio/master
Browse files Browse the repository at this point in the history
Support passing parameters to the Databricks cli in the run phase
  • Loading branch information
jullianoacqio authored Aug 4, 2020
2 parents 76347bc + f9bd679 commit fd9f8ce
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/utility/fs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def _impl(ctx):
'READER_CONFIG_FILE="%s"' % reader_config_file,
]

cmd_template = "$CLI $CMD $DEFAULT_OPTIONS {OPTIONS} {ARGS}"
cmd_template = "exe $CLI $CMD $DEFAULT_OPTIONS {OPTIONS} {ARGS}"

fsinfo_stampfile = ""
if ctx.attr.stamp:
Expand Down
1 change: 1 addition & 0 deletions internal/utility/helpers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ DBFS_PROPERTIES = {
CHECK_CONFIG_FILE = """
$READER_CONFIG_FILE $DEFAULT_OPTIONS --config_file $DATABRICKS_CONFIG_FILE
"""

CMD_CLUSTER_INFO = """
CLUSTER_ID=$($CLI clusters list $DEFAULT_OPTIONS --output JSON | \
$JQ_TOOL -r \'(.clusters[] | select (.cluster_name=="\'$CLUSTER_NAME\'")).cluster_id\')
Expand Down
6 changes: 3 additions & 3 deletions internal/utility/libraries.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _impl(ctx):
'READER_CONFIG_FILE="%s"' % reader_config_file,
]

cmd_template = "$CLI $CMD $DEFAULT_OPTIONS {OPTIONS}"
cmd_template = "exe $CLI $CMD $DEFAULT_OPTIONS {OPTIONS}"

if api_cmd in ["install", "uninstall"]:
if ctx.attr.dbfs:
Expand All @@ -66,7 +66,7 @@ def _impl(ctx):
variables += ["STAMP=$(cat %s)" % dbfs[FsInfo].stamp_file.short_path]

if api_cmd == "install":
cmd += ["exe '%s'" % dbfs[DefaultInfo].files_to_run.executable.short_path]
cmd += ["'%s' $@" % dbfs[DefaultInfo].files_to_run.executable.short_path]

cmd += [cmd_template.format(OPTIONS = "--jar %s" % f) for f in dbfs[FsInfo].dbfs_files_path]

Expand All @@ -83,7 +83,7 @@ def _impl(ctx):
]

if api_cmd == "cluster-status":
cmd += ["%s | $JQ_TOOL ." % cmd_template.format(OPTIONS = "")]
cmd += ["%s" % cmd_template.format(OPTIONS = "")]

ctx.actions.expand_template(
is_executable = True,
Expand Down
1 change: 0 additions & 1 deletion internal/utility/script.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -euo pipefail
echo $0

function exe() { echo "\$ ${@/eval/}" ; "$@" ; }

Expand Down

0 comments on commit fd9f8ce

Please sign in to comment.