cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Data bricks cluster creation is failing while running the Cron job scheduling script through init script method from azure data bricks.

Sugumar_Sriniva
New Contributor III

Dear connections,

I'm unable to run a shell script which contains scheduling a Cron job through init script method on Azure Data bricks cluster nodes.

Error from Azure Data bricks workspace:

"databricks_error_message": "Cluster scoped init script dbfs:/<shell-script> failed: Script exit status is non-zero"

Looking for a method to achieve the same.

1 ACCEPTED SOLUTION

Accepted Solutions

User16764241763
Honored Contributor

Hello @Sugumar Srinivasan​  Could you please enable cluster log delivery and inspect the INIT script logs in the below path dbfs:/cluster-logs/<clusterId>/init_scripts path.

https://docs.databricks.com/clusters/configure.html#cluster-log-delivery-1

View solution in original post

12 REPLIES 12

Anonymous
Not applicable

Hello @Sugumar Srinivasan​ - Welcome to the community! It's nice to meet you. My name is Piper, and I'm a moderator for Databricks.

Let's give the other members a chance to answer your question. We'll come back to this if we need to. 🙂

-werners-
Esteemed Contributor III

I do not completely understand what you are trying to do?

Are you trying to schedule a cron job on the cluster workers?

Sugumar_Sriniva
New Contributor III

Hi werners,

I need to perform the cleanup of azure data bricks driver logs (std.out, std.err, log4j) from dbfs path every hour. to achieve this I'm trying to schedule one Cron job on data bricks driver node so that logs can be deleted every one hour. While using below script in init, the azure databricks cluster creation is failing.

The shell script contains below content:

dbfs:/FileStore/crontab-setup-for-log-cleanup.sh

sudo -H -u root bash -c 'echo "$(echo "* */5 * * * sh /dbfs/FileStore/driver-logs-cleanup.sh" ; crontab -l 2>&1)" | crontab -'

-werners-
Esteemed Contributor III

Does the script work while the cluster is running, to exclude a issue with the script itself?

Yes I'm able to make a cron entry in the running cluster's spark driver node through ssh. ​

Tasootoor1998
New Contributor III

DataBricks Cluster Creation is failing while running the cron job scheduling script through init Script Method from Azure Data Bricks

Atanu
Esteemed Contributor
Esteemed Contributor

the issue is definitely the init script.Please cross check the init script or you can post it here if no sensitive info. we can cross verify.

Atanu
Esteemed Contributor
Esteemed Contributor

@Sugumar Srinivasan​  are you able to check the init script to rectify the issue?

Sugumar_Sriniva
New Contributor III

@Atanu Sarkar​ ,

I m using the below shell script for trying to schedule the crontab in databricks node.

crontab-setup-for-log-cleanup.sh

sudo -H -u root bash -c 'echo "$(echo '* */3 * * * sh /dbfs/FileStore/driver-logs-cleanup.sh' ; crontab -l 2>&1)" | crontab -'

driver-logs-cleanup.sh

#!/bin/bash

#Find the the older stdout, stderr and log4j files and deletes it accordingly.

find /dbfs/cluster-logs/<db-cluster-id>/driver/ -name "stdout--*" -exec rm -f {} \;

find /dbfs/cluster-logs/<db-cluster-id>/driver/ -name "stderr--*" -exec rm -f {} \;

find /dbfs/cluster-logs/<db-cluster-id>/driver/ -name "log4j""-""*"".gz" -exec rm -f {} \;

Thanks & Regards,

Sugumar Srinivasan.

Kaniz
Community Manager
Community Manager

Hi @Sugumar Srinivasan​ , What DBR version are you using?

Hi @Sugumar Srinivasan​ ,

Just a friendly follow-up. Are you still having issues with your init script or not any more? Please let us know.

User16764241763
Honored Contributor

Hello @Sugumar Srinivasan​  Could you please enable cluster log delivery and inspect the INIT script logs in the below path dbfs:/cluster-logs/<clusterId>/init_scripts path.

https://docs.databricks.com/clusters/configure.html#cluster-log-delivery-1

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.