Frequently Asked Questions
On this page
Running Components
One or more of my output files are owned by root after running a component. Why is this?
In Linux, files created by Docker are owned by root by default.
You can set up the chown
attribute in your
config file to automatically transfer the ownership of files to the user
running the component. Any file output where an argument of the type
file with an output direction was used will also have their ownership
transferred.
Can I store helper functions as separate files?
Yes, though you’ll need to let Viash know which additional files are required to run the component. For example, if several helper functions are stored in an additional file mymodule.py or mymodule.R, use the following code to import the helper functions:
Python
In the functionality resources section in the config:
resources:
- type: python_script
path: script.py
- path: mymodule.py
In the main Python script:
import sys
## VIASH START
meta = { 'resources_dir': '.' }
## VIASH END
sys.path.append(meta['resources_dir'])
from mymodule import helper_fun
R
In the functionality resources section in the config:
resources:
- type: r_script
path: script.R
- path: mymodule.R
In the main R script:
## VIASH START
meta <- list(resources_dir = ".")
## VIASH END
source(paste0(meta[["resources_dir"]], "/mymodule.R"))
helper_fun(...)