Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More CI checks #119

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ jobs:
shell: bash -el {0}
run: |
source /opt/SIRF-SuperBuild/INSTALL/bin/env_sirf.sh
curl -fsSL https://raw.githubusercontent.com/SyneRBI/PETRIC/main/petric.py > petric.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need this line to overwrite any users' changes as per the README

Any modifications to petric.py are ignored.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, but does tha tuse this run.yml? I guess it does. But then this isn't really CI.

anyway.

Copy link
Member

@casperdcl casperdcl Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes all submission repos are a fork of this one, so they all use this run.yml.

  • pro: we all use the same petric.py
  • con: it's impossible for organisers to test changes to petric.py in CI
    • I've had to manually test any change(s)

We could de-sync forks from this repo, but I'd rather not (it might confuse participants)

dataset=Siemens_mMR_NEMA_IQ
curl -sfSL -o ${dataset}.zip https://petric.tomography.stfc.ac.uk/data/${dataset}.zip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
curl -sfSL -o ${dataset}.zip https://petric.tomography.stfc.ac.uk/data/${dataset}.zip
curl -fsSLO https://petric.tomography.stfc.ac.uk/data/${dataset}.zip

mkdir -p data; cd data; unzip -u ../${dataset}.zip; cd ..
test -f main.py || ln -s main_ISTA.py main.py
python <<EOF
import petric
from main import Submission, submission_callbacks
from cil.optimisation.algorithms import Algorithm
assert issubclass(Submission, Algorithm)
assert isinstance(submission_callbacks, list)
assert all(callable(callback) for callback in submission_callbacks)
srcdir, outdir, metrics = petric.data_dirs_metrics[0]
data = petric.get_data(srcdir)
assert data.OSEM_image.max() > 0
assert data.reference_image.max() > 0
assert data.FOV_mask.max() > 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may as well test init?

Suggested change
assert data.FOV_mask.max() > 0
assert data.FOV_mask.max() > 0
algo = Submission(data)

or maybe to avoid e.g. "could not find GPU"...

Suggested change
assert data.FOV_mask.max() > 0
assert data.FOV_mask.max() > 0
try:
algo = Submission(data)
except Exception:
from warnings import warn
warn("Submission.__init__ failed", RuntimeWarning, stacklevel=2)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd want to have a dummy submission then. Not sure what a test tells us that we know will fail. Anyway, that'll all be for PETRIC 2.0... I suggest to do minor clean-up here, and merge it when all done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run(1) is even more likely to fail than __init__ due to lacking GPU... but true, we could add a warning for that too.

EOF
full:
if: startsWith(github.ref, 'refs/tags')
Expand Down