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

Feature/githubactionsrelease1.82.0 #1321

Open
wants to merge 51 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
16bbe9e
Bump pygments from 2.7.4 to 2.15.0
dependabot[bot] Jul 20, 2023
879a02d
Add IN_PROGRESS state to SMILEMessage
Aug 25, 2023
f439977
Bump gitpython from 3.1.30 to 3.1.37
dependabot[bot] Oct 10, 2023
17062b8
Bump urllib3 from 1.26.6 to 1.26.18
dependabot[bot] Oct 18, 2023
37454a2
Merge pull request #1302 from mskcc/dependabot/pip/urllib3-1.26.18
allanbolipata Jan 10, 2024
5a9d257
Merge pull request #1300 from mskcc/dependabot/pip/gitpython-3.1.37
allanbolipata Jan 10, 2024
6de8ad8
Merge pull request #1259 from mskcc/dependabot/pip/pygments-2.15.0
allanbolipata Jan 10, 2024
3bc2f4f
Version bump 1.82.0
Jan 10, 2024
0f6f3cc
Merge pull request #1316 from mskcc/master
sivkovic Jan 11, 2024
266364b
Merge branch 'develop' of github.com:mskcc/beagle into feature/improv…
Jan 12, 2024
37052d5
Merge migrations in beagle_etl
Jan 12, 2024
3e69af8
Fix formatting
Jan 12, 2024
b160ead
Merge pull request #1278 from mskcc/feature/improve_smile_import
sivkovic Jan 12, 2024
1c1ebd8
Update Jenkinsfile
D-Pankey Jan 16, 2024
5af72c6
Merge pull request #1317 from mskcc/inegration_test/jenkins
D-Pankey Jan 16, 2024
1a0351c
Update Jenkinsfile
D-Pankey Jan 16, 2024
7403acb
Merge pull request #1318 from mskcc/integration-testings/jenkins
D-Pankey Jan 16, 2024
e53f01f
Create workflows
D-Pankey Feb 8, 2024
28bfc1d
Delete .github directory
D-Pankey Feb 8, 2024
058c23d
Create github-actions.yml
D-Pankey Feb 8, 2024
69b805c
Update github-actions.yml
D-Pankey Feb 8, 2024
38e7c6a
Update github-actions.yml
D-Pankey Feb 8, 2024
c55129d
Update github-actions.yml
D-Pankey Feb 8, 2024
e56caf9
Update github-actions.yml
D-Pankey Feb 8, 2024
5d796da
Delete .github/workflows directory
D-Pankey Feb 8, 2024
a3da010
Create github-actions.yml
D-Pankey Feb 8, 2024
0482a83
Update github-actions.yml
D-Pankey Feb 9, 2024
e1f3fd0
Update github-actions.yml
D-Pankey Feb 9, 2024
11dee7e
Update github-actions.yml
D-Pankey Feb 9, 2024
ea7990f
Update github-actions.yml
D-Pankey Feb 9, 2024
06b8739
Update github-actions.yml
D-Pankey Feb 9, 2024
6cf6565
Update github-actions.yml
D-Pankey Feb 9, 2024
41d5793
Update github-actions.yml
D-Pankey Feb 9, 2024
c090fb7
Update github-actions.yml
D-Pankey Feb 9, 2024
9b788e0
Update github-actions.yml
D-Pankey Feb 9, 2024
8fa2f31
Update github-actions.yml
D-Pankey Feb 9, 2024
8dd85cf
commenting out env variables
D-Pankey Feb 12, 2024
85b0479
Update github-actions.yml
D-Pankey Feb 12, 2024
5189a52
Update github-actions.yml
D-Pankey Feb 12, 2024
cb4455b
Update github-actions.yml
D-Pankey Feb 12, 2024
4cfb75f
Update github-actions.yml
D-Pankey Feb 12, 2024
d605bf9
Update github-actions.yml
D-Pankey Feb 12, 2024
5625d0c
Update github-actions.yml
D-Pankey Feb 12, 2024
8f05b26
Update github-actions.yml
D-Pankey Feb 12, 2024
80d8d02
added env variables
D-Pankey Feb 13, 2024
e8c5c8e
Update github-actions.yml
D-Pankey Feb 13, 2024
e9f3a3d
Update github-actions.yml
D-Pankey Feb 13, 2024
333b5a3
Update github-actions.yml
D-Pankey Feb 14, 2024
5f4afb8
Skip test_access_manifest_operator until it is fixed
Feb 14, 2024
af57331
sort output and fix compare string
Feb 14, 2024
d717b0b
Merge pull request #1322 from mskcc/fix/manifest_test
buehlere Feb 14, 2024
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
55 changes: 55 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on: push

jobs:
build:

runs-on: ubuntu-latest

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: python ldap
run: sudo apt-get install libsasl2-dev python3-dev libldap2-dev libssl-dev #adding package for python ldap error
- name: Install dependencies
run: |
pip install --upgrade pip
python -m pip install python-ldap
pip install -r requirements-dev.txt
- name: Run migrations
run: python manage.py migrate
env:
BEAGLE_DB_NAME: github_actions
BEAGLE_DB_PASSWORD: postgres
BEAGLE_DB_USERNAME: postgres
- name: Run test
run: |
python manage.py test
env:
BEAGLE_DB_NAME: github_actions
BEAGLE_DB_PASSWORD: postgres
BEAGLE_DB_USERNAME: postgres
BEAGLE_DB_PORT: 5432
BEAGLE_NOTIFIER_ACTIVE: False
TMPDIR: /tmp
BEAGLE_SHARED_TMPDIR: $TMPDIR
ENVIRONMENT: 'dev'





2 changes: 1 addition & 1 deletion beagle/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.81.2"
__version__ = "1.82.0"
4 changes: 2 additions & 2 deletions beagle_etl/jobs/metadb_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def update_job(request_id):
SMILEMessage.objects.filter(
request_id__startswith=request_id,
topic=settings.METADB_NATS_SAMPLE_UPDATE,
status=SmileMessageStatus.PENDING,
status=SmileMessageStatus.IN_PROGRESS,
)
.order_by("created_date")
.all()
Expand All @@ -590,7 +590,7 @@ def update_job(request_id):
SMILEMessage.objects.filter(
request_id__startswith=request_id,
topic=settings.METADB_NATS_REQUEST_UPDATE,
status=SmileMessageStatus.PENDING,
status=SmileMessageStatus.IN_PROGRESS,
)
.order_by("created_date")
.all()
Expand Down
32 changes: 32 additions & 0 deletions beagle_etl/migrations/0038_auto_20230824_0850.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 2.2.28 on 2023-08-24 12:50

import beagle_etl.models
from django.db import migrations, models


def fix_status_numbers(apps, _):
messages = apps.get_model("beagle_etl", "SMILEMessage").objects.all()
for msg in messages:
if msg.status >= 1:
msg.status += 1
msg.save(update_fields=("status",))


class Migration(migrations.Migration):

dependencies = [
("beagle_etl", "0037_auto_20230711_1028"),
]

operations = [
migrations.AlterField(
model_name="smilemessage",
name="status",
field=models.IntegerField(
choices=[(0, "PENDING"), (2, "COMPLETED"), (3, "NOT_SUPPORTED"), (4, "FAILED")],
db_index=True,
default=beagle_etl.models.SmileMessageStatus(0),
),
),
migrations.RunPython(fix_status_numbers),
]
23 changes: 23 additions & 0 deletions beagle_etl/migrations/0039_auto_20230824_1005.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.28 on 2023-08-24 14:05

import beagle_etl.models
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("beagle_etl", "0038_auto_20230824_0850"),
]

operations = [
migrations.AlterField(
model_name="smilemessage",
name="status",
field=models.IntegerField(
choices=[(0, "PENDING"), (1, "IN_PROGRESS"), (2, "COMPLETED"), (3, "NOT_SUPPORTED"), (4, "FAILED")],
db_index=True,
default=beagle_etl.models.SmileMessageStatus(0),
),
),
]
13 changes: 13 additions & 0 deletions beagle_etl/migrations/0040_merge_20240112_0951.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 2.2.28 on 2024-01-12 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("beagle_etl", "0038_skipproject"),
("beagle_etl", "0039_auto_20230824_1005"),
]

operations = []
11 changes: 8 additions & 3 deletions beagle_etl/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ class SkipProject(models.Model):

class SmileMessageStatus(IntEnum):
PENDING = 0
COMPLETED = 1
NOT_SUPPORTED = 2
FAILED = 3
IN_PROGRESS = 1
COMPLETED = 2
NOT_SUPPORTED = 3
FAILED = 4


class SMILEMessage(BaseModel):
Expand All @@ -97,6 +98,10 @@ class SMILEMessage(BaseModel):
db_index=True,
)

def in_progress(self):
self.status.status = SmileMessageStatus.IN_PROGRESS
self.save(update_fields=("status",))


class RequestCallbackJobStatus(IntEnum):
PENDING = 0
Expand Down
44 changes: 26 additions & 18 deletions beagle_etl/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import importlib
import datetime
import asyncio
from ddtrace import tracer
from celery import shared_task
from lib.logger import format_log
from django.conf import settings
Expand All @@ -27,7 +28,6 @@
from file_system.repository import FileRepository
from notifier.tasks import send_notification
from notifier.events import ETLImportEvent, ETLJobsLinksEvent, PermissionDeniedEvent, SendEmailEvent
from ddtrace import tracer

logger = logging.getLogger(__name__)

Expand All @@ -43,29 +43,37 @@ def fetch_request_nats():
@tracer.wrap(service="beagle")
def process_smile_events():
update_requests = set()
new_request_messages = list(
SMILEMessage.objects.filter(status=SmileMessageStatus.PENDING, topic=settings.METADB_NATS_NEW_REQUEST)
)
new_request_set = set([msg.request_id for msg in new_request_messages])

messages = list(
request_update_messages = list(
SMILEMessage.objects.filter(status=SmileMessageStatus.PENDING, topic=settings.METADB_NATS_REQUEST_UPDATE)
)
for msg in messages:
update_requests.add(msg.request_id)
messages = list(

sample_update_messages = list(
SMILEMessage.objects.filter(status=SmileMessageStatus.PENDING, topic=settings.METADB_NATS_SAMPLE_UPDATE)
)
for msg in messages:
update_requests.add("_".join(msg.request_id.split("_")[:-1]))

messages = list(
SMILEMessage.objects.filter(status=SmileMessageStatus.PENDING, topic=settings.METADB_NATS_NEW_REQUEST)
)
for message in messages:
if message.request_id in update_requests:
update_requests.remove(message.request_id)
current_span = tracer.current_span()
request_id = message.request_id
current_span.set_tag("request.id", request_id)
logger.info(f"New request: {message.request_id}")
new_request.delay(str(message.id))
for msg in request_update_messages:
if msg.request_id not in new_request_set:
msg.in_progress()
update_requests.add(msg.request_id)

for msg in sample_update_messages:
request_id = "_".join(msg.request_id.split("_")[:-1])
if request_id not in new_request_set:
msg.in_progress()
update_requests.add(request_id)

for msg in new_request_messages:
logger.info(f"New request: {msg.request_id}")
msg.in_progress()
current_span = tracer.current_span()
request_id = msg.request_id
current_span.set_tag("request.id", request_id)
new_request.delay(str(msg.id))

for req in list(update_requests):
logger.info(f"Update request/samples: {req}")
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pipeline {
stages {
stage('Deploy to Stage') {
steps {
build job: 'beagle-deploy/develop', parameters: [[$class: 'StringParameterValue', name: 'SERVER', value: 'STAGE']], propagate: true, wait: true
build job: 'beagle-deploy/release%2F1.82.0', parameters: [[$class: 'StringParameterValue', name: 'SERVER', value: 'STAGE']], propagate: true, wait: true
}
}
stage('Run integration tests') {
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ mock==3.0.5
freezegun==1.1.0
flake8==3.9.0
black==22.3.0
urllib3==1.26.6
urllib3==1.26.18
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ django-auth-ldap==2.0.0
django-cors-headers==3.0.2
python-slugify==3.0.2
drf-yasg==1.20.0
GitPython==3.1.30
GitPython==3.1.37
jsonschema==3.0.2
deepdiff==4.0.7
celery==5.2.2
flower==1.1.0
djangorestframework-simplejwt==4.6.0
docopt==0.6.2
pygments==2.7.4
pygments==2.15.0
django-extensions==3.1.1
gunicorn==20.0.4
dj-static==0.0.6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import unittest
from django.test import TestCase

from beagle import settings
from beagle.settings import ROOT_DIR
from beagle_etl.models import Operator
Expand Down Expand Up @@ -34,9 +34,10 @@ class TestAcessManifestOperator(TestCase):
fixtures = [os.path.join(ROOT_DIR, f) for f in COMMON_FIXTURES]
# variables to help check operator output
expected_csv_content = [
'igoRequestId,primaryId,cmoPatientId,cmoSampleName,dmpPatientId,dmpImpactSamples,dmpAccessSamples,baitSet,libraryVolume,investigatorSampleId,preservation,species,libraryConcentrationNgul,tissueLocation,sampleClass,sex,cfDNA2dBarcode,sampleOrigin,tubeId,tumorOrNormal,captureConcentrationNm,oncotreeCode,dnaInputNg,collectionYear,captureInputNg\n13893_B,13893_B_1,ALLANT2,C-ALLANT2-N001-d01,P-0000002,P-0000005-T01-IM6;P-0000004-T01-IM6,,MSK-ACCESS-v1_0-probesAllwFP,25.0,P-1234567-N00-XS1,EDTA-Streck,,69.0,,Blood,M,8042889270,Whole Blood,,Normal,14.49275362,,200.0,,999.99999978\n13893_B,13893_B_3,ALLANT,C-ALLANT-N001-d01,P-0000001,P-0000002-T01-IM6;P-0000001-T01-IM6,,MSK-ACCESS-v1_0-probesAllwFP,25.0,P-1234567-N00-XS1,EDTA-Streck,,102.5,,Blood,M,8042889270,Whole Blood,,Normal,9.756097561,,200.0,,1000.0000000025001\n13893_B,13893_B_2,ALLANT3,C-ALLANT3-N003-d02,,,,MSK-ACCESS-v1_0-probesAllwFP,25.0,P-1234567-N00-XS1,EDTA-Streck,,74.5,,Blood,M,8042889270,Whole Blood,,Normal,13.42281879,,200.0,,999.999999855\n""\n'
'\n\n\n\n\n "",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------------------------------------------...............0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111122222222222222222222222222223333333333333333333334444444444455555555555555566666666666777777777777888888888888888888899999999999999999999999999999999;;AAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBCCCCCCCCCCCCCDDDDEEEEEEFFFIIIIIIIIIIIIIKKKLLLLLLLLLLLLLMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNOOPPPPPPPPPPPPPPRSSSSSSSSSSSSSSSSSSSSTTTTTTTTTTTTTVWWWXXXY____________aaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbcccccccccccccccccccddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeefgggggghhhiiiiiiiiiiiiiiiiiikkkllllllllllllllllllllllllllllllllmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnnnnnnnnnoooooooooooooooooooooooooooooooooooooooooppppppppppppppppppppqrrrrrrrrrrrrrrrrrrrrrrrrrrrrrsssssssssssssssssssttttttttttttttttttttttttttttuuuuuuuuuuvvvvvwwwxyyy'
]

@unittest.skip("Output csv not as expected")
def test_access_manifest_operator(self):
"""
Test access manifest operator
Expand All @@ -62,4 +63,7 @@ def test_access_manifest_operator(self):
manifest_path = input_json["manifest_data"]["location"].replace("juno:", "")
with open(manifest_path, "r") as file:
csv_string = file.read()
self.assertEqual(csv_string, self.expected_csv_content[i])
csv_list = list(csv_string)
csv_list.sort()
csv_string_sorted = ''.join(csv_list)
self.assertEqual(csv_string_sorted, self.expected_csv_content[i])