Search code examples
azure-databricks

How can I run a scala command line in databricks?


In databricks, I wish to run the following scala command

scala [-cp scalatest-<version>.jar:...] org.scalatest.tools.Runner [arguments]

Can this be run within a scala notebook, or as a job?

I have tried various ways of running this command from within a notebook without success. I'm not sure if its possible or if I need to structure the sytax in such a way for it to work.

scalatest_2.12__3.0.8.jar is included within the databricks runtime


Solution

  • A databricks job can be defined which runs a scalatest project:

    specify: Main class: org.scalatest.tools.Runner

    Dependent libraries: (eg a jar containing the scalatest project)

    Parameters: ["-R","dbfs:/ourProject.jar","-o","-f","/dbfs/ourLog.txt","-s","uk.xxx.xxx.xxx.Main","-DmaxConnections=100"]