Closed Jongmassey closed 6 months ago
NB this adds an authorisation dialog on codespace startup
we should add this to the docs
To test this I did the following (which I won't commit to this branch as we don't want it in the main research template).
With a project.yaml
of:
version: '3.0'
# Ignore this`expectation` block. It is required but not used, and will be removed in future versions.
expectations:
population_size: 1000
actions:
generate_dataset:
run: ehrql:v1 generate-dataset analysis/dataset_definition.py --output output/dataset.csv
outputs:
highly_sensitive:
dataset: output/dataset.csv
stata_action:
run: stata-mp:latest analysis/stata.do
needs: [generate_dataset]
outputs:
moderately_sensitive:
dataset: null.csv
And a stata.do
file of:
capture noisily import delimited ./output/output/dataset.csv, clear
Gives the following output:
rstudio@codespaces-1a7114:/workspaces/research-template$ opensafely run run_all -f
Fetching missing docker image: docker pull ghcr.io/opensafely-core/stata-mp:latest
latest: Pulling from opensafely-core/stata-mp
31bd5f451a84: Pull complete
1a6ee09d066f: Pull complete
55f7cdae42fa: Pull complete
a42e12a75987: Pull complete
e86a092ef517: Pull complete
ca811edb1d98: Pull complete
3734afaf51d6: Pull complete
038ea78eb362: Pull complete
586414386b09: Pull complete
1c8b1ff1d550: Pull complete
4f4fb700ef54: Pull complete
66c39923669a: Pull complete
f943eb11a513: Pull complete
e6b308b3e3b4: Pull complete
a5018df23185: Pull complete
5ef36c74616d: Pull complete
33f3283b6e62: Pull complete
Digest: sha256:e98addabe212a12ed2baf0854e5568c361c280863c38047cb8d472216ba1cf21
Status: Downloaded newer image for ghcr.io/opensafely-core/stata-mp:latest
ghcr.io/opensafely-core/stata-mp:latest
Fetching missing docker image: docker pull ghcr.io/opensafely-core/ehrql:v1
v1: Pulling from opensafely-core/ehrql
3c67549075b6: Pull complete
49bd3e0ffcce: Pull complete
903589a32593: Pull complete
c3f0f10ca1d7: Pull complete
f4bd2e5548ba: Pull complete
fbbbb4d109e4: Pull complete
4f4fb700ef54: Pull complete
aeb773ef00f3: Pull complete
fbef4effabd9: Pull complete
e4f364c7a1bc: Pull complete
d26146715345: Pull complete
0fbd16982438: Pull complete
1a293b34cc2f: Pull complete
b2a6e8a1b7e8: Pull complete
Digest: sha256:97baa6d30e2fb18535979b950cd387c9d653fa8de184a9afa0d219f49c0e0d7a
Status: Downloaded newer image for ghcr.io/opensafely-core/ehrql:v1
ghcr.io/opensafely-core/ehrql:v1
Fetching missing docker image: docker pull ghcr.io/opensafely-core/busybox
Using default tag: latest
latest: Pulling from opensafely-core/busybox
22b70bddd3ac: Pull complete
Digest: sha256:dacd1aa51e0b27c0e36c4981a7a8d9d8ec2c4a74bf125c0a44d0709497a522e9
Status: Downloaded newer image for ghcr.io/opensafely-core/busybox:latest
ghcr.io/opensafely-core/busybox:latest
Running actions: generate_dataset, stata_action
jobrunner.run loop started
generate_dataset: Preparing your code and workspace files
generate_dataset: Copying in code from /workspaces/research-template
generate_dataset: Prepared and ready to run
generate_dataset: Executing job on the backend
generate_dataset: Job has finished executing and is waiting to be finalized
generate_dataset: Recording job results
generate_dataset: Extracting output file: output/dataset.csv
generate_dataset: Logs written to: /workspaces/research-template/metadata/generate_dataset.log
generate_dataset: Finished recording results
generate_dataset: Completed successfully
generate_dataset: Cleaning up container and volume
stata_action: Preparing your code and workspace files
stata_action: Copying in code from /workspaces/research-template
stata_action: Copying input file: output/dataset.csv
stata_action: Prepared and ready to run
stata_action: Executing job on the backend
stata_action: Job has finished executing and is waiting to be finalized
stata_action: Recording job results
stata_action: Logs written to: /workspaces/research-template/metadata/stata_action.log
stata_action: Finished recording results
stata_action: No outputs found matching patterns:
- null.csv
stata_action: Cleaning up container and volume
=> generate_dataset
Completed successfully
log file: metadata/generate_dataset.log
outputs:
output/dataset.csv - highly_sensitive
=> stata_action
No outputs found matching patterns:
- null.csv
Did you mean to match one of these files instead?
- stata.log
log file: metadata/stata_action.log
outputs:
(no outputs)
This gives the auto-generated PAT used for git operations within this codespace read permissions to the server-instructions repo which contains the stata license file needed to run stata actions.
Fixes https://github.com/opensafely-core/research-template-docker/issues/27