Closed abemelvin closed 1 year ago
nvm I see you're utilizing data
field in the BUILD
target :) closing
I need to do something like this to get any csv files inside the /data folder, but I dont think Bazel likes this.
export_files(["*.csv])
If you use bazel runfiles, you can get entire directories of files
In the relevant BUILD
file/target, add requirement("bazel-runfiles")
to your deps
list (this is a Python library so you'll need to install it bazel_runfiles
)
Then, in the Python target itself you can do
import os
import runfiles
r = runfiles.CreateDirectoryBased(os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], your_dir_here))
dir_path = r.Rlocation('.')
https://github.com/qjawls2003/Windows_Anomaly_Detection/blob/3401cb6cc71969395a232447a4613a06054e2f08/pre_processing/src/csv_to_df.py#L8
Bazel runfiles: https://github.com/bazelbuild/bazel/blob/master/tools/python/runfiles/runfiles.py