Skip to content

Create event when order with external samples is submitted - #5292

Merged
mogmi merged 26 commits into
dev-external-natsfrom
publish-external-order
Sep 9, 2026
Merged

Create event when order with external samples is submitted#5292
mogmi merged 26 commits into
dev-external-natsfrom
publish-external-order

Conversation

@diitaz93

Copy link
Copy Markdown
Contributor

Description

Added

Changed

Fixed

How to prepare for test

  • Ssh to relevant server (depending on type of change)
  • Use stage: us
  • Paxa the environment: paxa
  • Install on stage (example for Hasta):
    bash /home/proj/production/servers/resources/hasta.scilifelab.se/update-tool-stage.sh -e S_cg -t cg -b [THIS-BRANCH-NAME] -a

How to test

  • Do ...

Expected test outcome

  • Check that ...
  • Take a screenshot and attach or copy/paste the output.

Review

  • Tests executed by
  • "Merge and deploy" approved by
    Thanks for filling in who performed the code review and the test!

This version is a

  • MAJOR - when you make incompatible API changes
  • MINOR - when you add functionality in a backwards compatible manner
  • PATCH - when you make backwards compatible bug fixes or documentation/instructions

Implementation Plan

  • Document in ...
  • Deploy this branch on ...
  • Inform to ...

@islean
islean changed the base branch from master to dev-external-nats September 2, 2026 08:09
@islean

islean commented Sep 3, 2026

Copy link
Copy Markdown
Member

Double check that the auth info for NATS is gathered from the environment rather than cg.yaml since the ordering service is running on the VM

@clingen-sthlm
clingen-sthlm temporarily deployed to stage September 4, 2026 11:39 Inactive
@clingen-sthlm
clingen-sthlm temporarily deployed to stage September 9, 2026 11:40 Inactive
@clingen-sthlm
clingen-sthlm temporarily deployed to stage September 9, 2026 12:19 Inactive
@islean
islean marked this pull request as ready for review September 9, 2026 12:29
@islean
islean requested a review from a team as a code owner September 9, 2026 12:29
@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

Copy link
Copy Markdown

@mogmi
mogmi merged commit 5e1ec6a into dev-external-nats Sep 9, 2026
7 checks passed
@mogmi
mogmi deleted the publish-external-order branch September 9, 2026 12:33
mogmi added a commit that referenced this pull request Sep 10, 2026
…) (minor)

## Description
Provide support to message publishing using nats-py. Currently used in the new `external_sample_transferred_handler` and in the order storing service.

### Added

- New methods to the event publisher that establish a connection to the NATS server, publish a message and drain the connection asynchronously.
- `external_sample_transferred_handler` that adds the transferred files to HK and publishes an event using the new event_publisher method to start an analysis
- New HK API method that adds bundle and version to the DB transaction but does not commit.
- New HK method that hard-links files to the bundle dirs and commits

### Changed

- The OrderSubmitter now recieved a NatsConfig object and a store as parameters
- NATS env variables can now be parsed by the app_config obj
- 

### Fixed

- Unifies all event names and payload fields in constants in `cg/services/events/constants.py`
- rename directory `tests/services/orders/validation_service` to `tests/services/orders/validation`


---------

Co-authored-by: Rasmus Burge <80392398+RasmusBurge-CG@users.noreply.github.com>
Co-authored-by: Sebastian Diaz <juan.sebastian.diaz.boada@scilifelab.se>
Co-authored-by: Linnéa Löfdahl <linnea.lofdahl@scilifelab.se>
Co-authored-by: Moe Darrah <41540288+moedarrah@users.noreply.github.com>
Co-authored-by: kedhammar <alfred.kedhammar@scilifelab.se>
Co-authored-by: Alfred Kedhammar <89784800+kedhammar@users.noreply.github.com>

* Create event when order with external samples is submitted (#5292)

* WIP

* fix type hints

* Add TODOs

* WIP

* TODO

* add statusdb to order

* add passing function

* Work on submitter

* WIP

* implement tests for submit with new functionality

* WIP

* add tests

* Fix typehint for Order external_samples (#5296)

* wip red

* add app_config settings for NATS

* Work on adding NatsConfig in the app_config

* wip red

* rename nats env variables

* update renaming

* Change order of publishing of events

* red wip

* Fix failing tests

* Change logging

---------

Co-authored-by: Moe Darrah <41540288+moedarrah@users.noreply.github.com>
Co-authored-by: kedhammar <alfred.kedhammar@scilifelab.se>
Co-authored-by: islean <isak.ohlsson.angnell@gmail.com>
Co-authored-by: Linnéa Löfdahl <linnea.lofdahl@scilifelab.se>
Co-authored-by: Isak Ohlsson Ångnell <40887124+islean@users.noreply.github.com>

* Standardise event and field names (#5303)

* Start standardising names

* Rework the field names

* Start on event names

* WIP

* Green tests

* return hint

---------

Co-authored-by: Linnéa Löfdahl <linnea.lofdahl@scilifelab.se>
Co-authored-by: Moe Darrah <41540288+moedarrah@users.noreply.github.com>
Co-authored-by: Sebastian Diaz <juan.sebastian.diaz.boada@scilifelab.se>

* rename constants from subject to events

* rename constants from subject to events

* Clarify event publisher function names (#5306)

* Rename publish_command to get_publish_command

* Rename publish to publish_event

* Address comments

* Send in event_name to publish_command

---------

Co-authored-by: Isak Ohlsson Ångnell <40887124+islean@users.noreply.github.com>
Co-authored-by: Rasmus Burge <80392398+RasmusBurge-CG@users.noreply.github.com>
Co-authored-by: Linnéa Löfdahl <linnea.lofdahl@scilifelab.se>
Co-authored-by: Moe Darrah <41540288+moedarrah@users.noreply.github.com>
Co-authored-by: kedhammar <alfred.kedhammar@scilifelab.se>
Co-authored-by: Alfred Kedhammar <89784800+kedhammar@users.noreply.github.com>
Co-authored-by: islean <isak.ohlsson.angnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants