Skip to content

Commit 81da0ee

Browse files
committed
less aggressive images cleanup and added explicit units in gparticle
1 parent e0aa4e4 commit 81da0ee

15 files changed

Lines changed: 189 additions & 158 deletions

File tree

.github/workflows/cleanup.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ permissions:
2222
packages: write # needed for deletions with GITHUB_TOKEN
2323

2424
env:
25-
# Untagged versions are orphaned GHCR package versions left after tags move or manifests/caches are rewritten.
26-
UNTAGGED_RETENTION_HOURS: 12
25+
# Keep untagged versions. GHCR exposes platform child manifests for tagged OCI indexes as untagged
26+
# package versions, and deleting them can break docker pull for visible multi-arch tags.
2727
# Stale tagged versions still have tags, but those tags are no longer generated by the current image matrix.
2828
STALE_TAGGED_RETENTION_DAYS: 14
2929

@@ -76,15 +76,14 @@ jobs:
7676
KEEP_TAGS: ${{ steps.keep-tags.outputs.json }}
7777
MANAGED_IMAGES: ${{ steps.keep-tags.outputs.images }}
7878
DRY_RUN: ${{ inputs.dry_run || 'false' }}
79-
UNTAGGED_RETENTION_HOURS: ${{ env.UNTAGGED_RETENTION_HOURS }}
8079
STALE_TAGGED_RETENTION_DAYS: ${{ env.STALE_TAGGED_RETENTION_DAYS }}
8180
with:
8281
script: |
8382
const keepTags = new Set(JSON.parse(process.env.KEEP_TAGS));
8483
const managedImages = JSON.parse(process.env.MANAGED_IMAGES);
8584
const dryRun = process.env.DRY_RUN === 'true';
86-
const untaggedRetentionMs = Number(process.env.UNTAGGED_RETENTION_HOURS) * 60 * 60 * 1000;
87-
const staleTaggedRetentionMs = Number(process.env.STALE_TAGGED_RETENTION_DAYS) * 24 * 60 * 60 * 1000;
85+
const staleTaggedRetentionMs =
86+
Number(process.env.STALE_TAGGED_RETENTION_DAYS) * 24 * 60 * 60 * 1000;
8887
const now = Date.now();
8988
9089
const owner = context.repo.owner;
@@ -127,9 +126,12 @@ jobs:
127126
const dates = `created ${version.created_at}, updated ${version.updated_at}`;
128127
129128
let reason = null;
130-
if (tags.length === 0 && ageMs > untaggedRetentionMs) {
131-
reason = `untagged older than ${process.env.UNTAGGED_RETENTION_HOURS} hours`;
132-
} else if (
129+
if (tags.length === 0) {
130+
core.info(`keep ${version.id}: ${tagList} (${dates}; may be a multi-arch child manifest)`);
131+
continue;
132+
}
133+
134+
if (
133135
tags.length > 0 &&
134136
ageMs > staleTaggedRetentionMs &&
135137
tags.every((tag) => !keepTags.has(tag)) &&
@@ -143,7 +145,9 @@ jobs:
143145
continue;
144146
}
145147
146-
core.info(`${dryRun ? 'would delete' : 'delete'} ${version.id}: ${tagList} (${reason}; ${dates})`);
148+
core.info(
149+
`${dryRun ? 'would delete' : 'delete'} ${version.id}: ${tagList} (${reason}; ${dates})`
150+
);
147151
if (!dryRun) {
148152
await deleteVersion({
149153
...ownerArgs,

examples/basic/b1/b1.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ g4camera:
2727

2828
gparticle:
2929
- name: gamma
30-
p: 6
31-
vz: -15
32-
delta_vx: 4
33-
delta_vy: 4
30+
p: 6*MeV
31+
vz: -15*cm
32+
delta_vx: 4*cm
33+
delta_vy: 4*cm
3434
multiplicity: 1

examples/basic/b2/b2.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ phys_list: FTFP_BERT
2020

2121
gparticle:
2222
- name: proton
23-
p: 3000
24-
vz: -250
23+
p: 3000*MeV
24+
vz: -250*cm
2525

2626
gmultipoles:
2727
- name: dipole

examples/basic/b3/b3.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ nthreads: 4
55

66
gparticle:
77
- name: e-
8-
p: 1500
9-
theta: 23.0
10-
delta_theta: 4.0
11-
delta_phi: 18.0
8+
p: 1500*MeV
9+
theta: 23*deg
10+
delta_theta: 4*deg
11+
delta_phi: 18*deg
1212
multiplicity: 1
1313

1414

examples/basic/material/materials.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ g4camera:
2424

2525
gparticle:
2626
- name: proton
27-
p: 2000
28-
vz: -3
29-
delta_vx: 0.1
30-
delta_vy: 0.1
27+
p: 2000*MeV
28+
vz: -3*cm
29+
delta_vx: 0.1*cm
30+
delta_vy: 0.1*cm
3131
multiplicity: 1

examples/basic/pyvista/pyvista.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ phys_list: QBBC
1414

1515
gparticle:
1616
- name: proton
17-
p: 1000
18-
vz: -5
19-
delta_vx: 0.5
20-
delta_vy: 0.5
17+
p: 1000*MeV
18+
vz: -5*cm
19+
delta_vx: 0.5*cm
20+
delta_vy: 0.5*cm
2121
multiplicity: 5

examples/basic/simple_flux/simple_flux.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ phys_list: QBBC
2020

2121
gparticle:
2222
- name: proton
23-
p: 2000
24-
vz: -3
25-
delta_vx: 0.1
26-
delta_vy: 0.1
23+
p: 2000*MeV
24+
vz: -3*cm
25+
delta_vx: 0.1*cm
26+
delta_vy: 0.1*cm
2727
multiplicity: 10

examples/optical/cherenkov/cherenkov.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ phys_list: FTFP_BERT + G4OpticalPhysics
2424

2525
gparticle:
2626
- name: e-
27-
p: 1000
28-
vz: -50
27+
p: 1000*MeV
28+
vz: -50*cm

gemc/gparticle/examples/gparticle_example.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* Usage example (shell):
1414
* @code
15-
* ./gparticle_example -gparticle="[{name: e-, p: 5000, punit: MeV}]"
15+
* ./gparticle_example -gparticle="[{name: e-, p: 5000*MeV, theta: 23*deg}]"
1616
* @endcode
1717
*
1818
* Notes:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
gparticle:
22
- name: e-
3-
p: 2300
4-
theta: 23.0
3+
p: 2300*MeV
4+
theta: 23*deg

0 commit comments

Comments
 (0)