Platform docs

Specifying outputs

Using Ontologic' special "outputs" directory depends on where you are calling from: within the IDE vs. on the platform.

Specify outputs in the "outputs" directory.

All tool outputs must be placed in a directory called outputs or it will be lost when the virtual machine used in a run instance shuts down.

Use an absolute path within the IDE

This directory is created at runtime, so it isn't visible inside the IDE. You can mimic the behavior by creating an outputs folder inside your default /home/ontologic directory.

Use a relative path outside the IDE

As an example, say you wanted to output a file with the text "Hello world." This can be done with the following bash command:
echo "Hello world" > outputs/myfile.txt
Or, if you are using python, you can use use whatever save function is relevant to you to create your output file, with the path entered as a string. For example, if you have a Matplotlib figure you want to save, you can use the following:

Dealing with output subdirectories

Let's say you have a tool that creates outputs that are organized in a file tree. This creates some minor complications, but they can be easily avoided. As an example, imagine that your tool creates one .csv file in the top-level outputs directory, but also creates a .csv nested in a subdirectory called foo. You would want your outputs directory structure to look like this:
If you save the first file as outputs/file.csv, there should be no problem. But if you try saving outputs/foo/nestedfile.csv, you will get an error. This is because the foo folder doesn't already exist, so you need to make it first. You can use bash command mkdir outputs/foo in your script to do this easily, and then create the nested file.
Finally, if your outputs folder has subdirectories, you might notice they don't show up in the "Output" tab of your run details page. Instead, there is just a flat list of files. This is because the platform keeps track of files as output entities, not directories. However, the platform keeps track of output directory structure in the data browser. By default, run outputs are placed in the "Tool Output" folder in your data browser. From here, you can preserve the directory structure as it is, or rearrange your output files however you want - they will always appear the same in the "Run Details" page.