Skip to content

Commit 4345c1b

Browse files
alanbchristieAlan Christie
and
Alan Christie
authored
Copies Target proposals to new (RHS) Compounds (#629)
* fix: Branch for project reference fix * fix: Projects copied from Target (during RHS cset-upload) * fix: Add save before copying projects * fix: Remove unnecessary save() * ci: Attempt to fix docker-compose problem * ci: Fix staging and production builds (docker compose) --------- Co-authored-by: Alan Christie <alan.christie@matildapeak.com>
1 parent 2275b00 commit 4345c1b

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

.github/workflows/build-dev.yaml

+5-6
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ jobs:
8585
with:
8686
context: .
8787
tags: ${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:${{ env.GITHUB_REF_SLUG }}
88-
- name: Test
89-
run: >
90-
docker-compose -f docker-compose.test.yml up
91-
--build
92-
--exit-code-from tests
93-
--abort-on-container-exit
88+
- name: Test (docker compose)
89+
uses: hoverkraft-tech/compose-action@v2.0.1
90+
with:
91+
compose-file: ./docker-compose.test.yml
92+
up-flags: --build --exit-code-from tests --abort-on-container-exit
9493
env:
9594
BE_NAMESPACE: ${{ steps.vars.outputs.BE_NAMESPACE }}
9695
BE_IMAGE_TAG: ${{ env.GITHUB_REF_SLUG }}

.github/workflows/build-production.yaml

+5-6
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,11 @@ jobs:
134134
tags: |
135135
${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:${{ steps.vars.outputs.tag }}
136136
${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:stable
137-
- name: Test
138-
run: >
139-
docker-compose -f docker-compose.test.yml up
140-
--build
141-
--exit-code-from tests
142-
--abort-on-container-exit
137+
- name: Test (docker compose)
138+
uses: hoverkraft-tech/compose-action@v2.0.1
139+
with:
140+
compose-file: ./docker-compose.test.yml
141+
up-flags: --build --exit-code-from tests --abort-on-container-exit
143142
env:
144143
BE_NAMESPACE: ${{ steps.vars.outputs.BE_NAMESPACE }}
145144
BE_IMAGE_TAG: ${{ steps.vars.outputs.tag }}

.github/workflows/build-staging.yaml

+5-6
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,11 @@ jobs:
154154
with:
155155
context: .
156156
tags: ${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:${{ steps.vars.outputs.tag }}
157-
- name: Test
158-
run: >
159-
docker-compose -f docker-compose.test.yml up
160-
--build
161-
--exit-code-from tests
162-
--abort-on-container-exit
157+
- name: Test (docker compose)
158+
uses: hoverkraft-tech/compose-action@v2.0.1
159+
with:
160+
compose-file: ./docker-compose.test.yml
161+
up-flags: --build --exit-code-from tests --abort-on-container-exit
163162
env:
164163
BE_NAMESPACE: ${{ steps.vars.outputs.BE_NAMESPACE }}
165164
BE_IMAGE_TAG: ${{ steps.vars.outputs.tag }}

viewer/cset_upload.py

+13
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,19 @@ def create_mol(self, inchi, target, name=None) -> Compound:
290290
current_identifier=name,
291291
)
292292
cpd.save()
293+
# This is a new compound.
294+
# We must now set relationships to the Proposal that it applies to.
295+
# We do this by copying the relationships from the Target.
296+
num_target_proposals = len(target.project_id.all())
297+
assert num_target_proposals > 0
298+
if num_target_proposals > 1:
299+
logger.warning(
300+
'Compound Target %s has more than one Proposal (%d)',
301+
target.title,
302+
num_target_proposals,
303+
)
304+
for project in target.project_set.all():
305+
cpd.project_id.add(project)
293306
except MultipleObjectsReturned as exc:
294307
# NB! when processing new uploads, Compound is always
295308
# fetched by inchi_key, so this shouldn't ever create

0 commit comments

Comments
 (0)