-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in relative path translation
- Loading branch information
Showing
11 changed files
with
172 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
The variable HERE is defined when running a step as the working directory relative to STEPUP_ROOT. | ||
When running a step, the HERE variable is defined as the working directory relative to STEPUP_ROOT. | ||
It may be convenient to create an output at a location based on the working directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
projects/work/.stepup | ||
projects/public | ||
current* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Relative (input, output, ...) paths given to steps are translated to relative directories to `${STEPUP_ROOT}` before they are passed to the director. | ||
This example checks the special situation that the relative directory contains a part of the parent directories of `${STEPUP_ROOT}`. | ||
This scenario is a bit unusual but may occur when inputs or outputs refer to external directories shared with other StepUp projects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env python | ||
from stepup.core.api import amend | ||
|
||
path_foo = "../projects/public/foo.txt" | ||
with open(path_foo, "w") as fh: | ||
fh.write("Test\n") | ||
amend(out=path_foo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
root: | ||
version = v1 | ||
creates file:../ | ||
creates file:../../ | ||
creates file:./ | ||
creates file:plan.py | ||
creates step:./plan.py | ||
|
||
file:plan.py | ||
path = plan.py | ||
state = STATIC | ||
created by root: | ||
consumes file:./ | ||
supplies step:./plan.py | ||
|
||
file:./ | ||
path = ./ | ||
state = STATIC | ||
created by root: | ||
supplies file:../ | ||
supplies file:plan.py | ||
supplies step:./plan.py | ||
supplies step:mkdir -p ../public/ | ||
|
||
step:./plan.py | ||
workdir = ./ | ||
command = ./plan.py | ||
state = SUCCEEDED | ||
created by root: | ||
consumes file:./ | ||
consumes file:plan.py | ||
creates file:../../common/ | ||
creates file:../../common/script.py | ||
creates step:./script.py # wd=../../common/ | ||
creates step:mkdir -p ../public/ | ||
|
||
file:../../common/ | ||
path = ../../common/ | ||
state = STATIC | ||
created by step:./plan.py | ||
consumes file:../../ | ||
supplies file:../../common/script.py | ||
supplies step:./script.py # wd=../../common/ | ||
|
||
file:../../ | ||
path = ../../ | ||
state = STATIC | ||
created by root: | ||
consumes file:../ | ||
supplies file:../../common/ | ||
|
||
file:../ | ||
path = ../ | ||
state = STATIC | ||
created by root: | ||
consumes file:./ | ||
supplies file:../../ | ||
supplies file:../public/ | ||
supplies step:mkdir -p ../public/ | ||
|
||
file:../../common/script.py | ||
path = ../../common/script.py | ||
state = STATIC | ||
created by step:./plan.py | ||
consumes file:../../common/ | ||
|
||
step:mkdir -p ../public/ | ||
workdir = ./ | ||
command = mkdir -p ../public/ | ||
state = SUCCEEDED | ||
created by step:./plan.py | ||
consumes file:../ | ||
consumes file:./ | ||
creates file:../public/ | ||
supplies file:../public/ | ||
|
||
file:../public/ | ||
path = ../public/ | ||
state = BUILT | ||
created by step:mkdir -p ../public/ | ||
consumes file:../ | ||
consumes step:mkdir -p ../public/ | ||
supplies file:../public/foo.txt | ||
supplies step:./script.py # wd=../../common/ | ||
|
||
step:./script.py # wd=../../common/ | ||
workdir = ../../common/ | ||
command = ./script.py | ||
state = SUCCEEDED | ||
consumes (amended) = file:../public/ | ||
supplies (amended) = file:../public/foo.txt | ||
created by step:./plan.py | ||
consumes file:../../common/ | ||
consumes file:../public/ | ||
creates file:../public/foo.txt | ||
supplies file:../public/foo.txt | ||
|
||
file:../public/foo.txt | ||
path = ../public/foo.txt | ||
state = BUILT | ||
created by step:./script.py # wd=../../common/ | ||
consumes file:../public/ | ||
consumes step:./script.py # wd=../../common/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DIRECTOR │ Launched worker 0 | ||
PHASE │ run | ||
START │ ./plan.py | ||
SUCCESS │ ./plan.py | ||
START │ mkdir -p ../public/ | ||
SUCCESS │ mkdir -p ../public/ | ||
START │ ./script.py # wd=../../common/ | ||
SUCCESS │ ./script.py # wd=../../common/ | ||
WORKFLOW │ Dumped to .stepup/workflow.mpk.xz | ||
PHASE │ watch | ||
DIRECTOR │ Stopping workers. | ||
DIRECTOR │ See you! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env -S bash -x | ||
# Exit on first error and cleanup. | ||
set -e | ||
trap 'kill $(pgrep -g $$ | grep -v $$) > /dev/null 2> /dev/null || :' EXIT | ||
xargs rm -rvf < .gitignore | ||
|
||
# Run the example | ||
cd projects/work | ||
stepup -w 1 plan.py & # > ../../current_stdout.txt & | ||
|
||
# Wait for the director and get its socket. | ||
export STEPUP_DIRECTOR_SOCKET=$( | ||
python -c "import stepup.core.director; print(stepup.core.director.get_socket())" | ||
) | ||
|
||
# Get the graph after completion of the pending steps. | ||
python3 - << EOD | ||
from stepup.core.interact import * | ||
wait() | ||
graph("../../current_graph") | ||
join() | ||
EOD | ||
|
||
# Wait for background processes, if any. | ||
wait | ||
|
||
# Check files that are expected to be present and/or missing. | ||
[[ -f plan.py ]] || exit 1 | ||
[[ -f ../public/foo.txt ]] || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env python | ||
from stepup.core.api import mkdir, static, step | ||
|
||
static("../../common/", "../../common/script.py") | ||
mkdir("../public/") | ||
step("./script.py", workdir="../../common/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters