Skip to content

Commit

Permalink
Merge pull request #1451 from AlexsLemonade/dev
Browse files Browse the repository at this point in the history
[HOTFIX] Deploy a couple minor changes to prod
  • Loading branch information
kurtwheeler authored Aug 5, 2019
2 parents 161f639 + 0874e18 commit 77b3b3d
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 9 deletions.
7 changes: 3 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,9 @@ workflows:
branches:
ignore: /.*/
tags:
# From CirlceCI Docs:
# If both only and ignore are specified the only is considered before ignore.
only: /v.*/
ignore: /v.*-hotfix/
# Only run deploys on versions tagged with /v.*/, unless regex
# lookahead finds `-hotfix` at the end of the version tag
only: /^v((?!-hotfix$).)*$/

hotfix-deploy:
jobs:
Expand Down
16 changes: 15 additions & 1 deletion api/data_refinery_api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ class DatasetSerializer(serializers.ModelSerializer):
start = serializers.NullBooleanField(required=False)
experiments = DatasetDetailsExperimentSerializer(source='get_experiments', many=True, read_only=True)
organism_samples = serializers.SerializerMethodField(read_only=True)
worker_version = serializers.SerializerMethodField(read_only=True)

def __init__(self, *args, **kwargs):
super(DatasetSerializer, self).__init__(*args, **kwargs)
Expand All @@ -616,6 +617,7 @@ def __init__(self, *args, **kwargs):
if 'details' not in kwargs['context']['request'].query_params:
self.fields.pop('experiments')
self.fields.pop('organism_samples')
self.fields.pop('worker_version')

# only include the field `download_url` if a valid token is specified
# the token lookup happens in the view.
Expand Down Expand Up @@ -646,7 +648,8 @@ class Meta:
'experiments',
'organism_samples',
'download_url',
'quantile_normalize'
'quantile_normalize',
'worker_version'
)
extra_kwargs = {
'data': {
Expand Down Expand Up @@ -693,6 +696,10 @@ class Meta:
},
'download_url': {
'read_only': True,
},
'worker_version': {
'read_only': True,
'help_text': 'Returns the latest version of refine.bio that was used to build this dataset.'
}
}

Expand Down Expand Up @@ -722,6 +729,13 @@ def get_organism_samples(self, obj):

return result

def get_worker_version(self, obj):
processor_jobs = obj.processor_jobs.order_by('-created_at').values_list('worker_version', flat=True)
if processor_jobs:
return processor_jobs[0]
else:
return None

class APITokenSerializer(serializers.ModelSerializer):

class Meta:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

from django.db import migrations
from data_refinery_common.utils import get_supported_rnaseq_platforms
from django.core.paginator import Paginator

def make_sample_platform_names_readable(apps, schema_editor):
Sample = apps.get_model('data_refinery_common', 'Sample')

for platform_name in get_supported_rnaseq_platforms():
munged_platform = platform_name.replace(' ', '')
Sample.objects.all().filter(platform_name=munged_platform).update(platform_name=platform_name)
print("Updating platform name from \'%s\' to \'%s\'" % (munged_platform, platform_name))

class Migration(migrations.Migration):

dependencies = [
('data_refinery_common', '0022_auto_20190607_1505'),
]

operations = [
migrations.RunPython(make_sample_platform_names_readable)
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1.8 on 2019-07-26 18:41

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('data_refinery_common', '0023_fix_platform_names_spaces'),
]

operations = [
migrations.AddField(
model_name='dataset',
name='processor_jobs',
field=models.ManyToManyField(through='data_refinery_common.ProcessorJobDatasetAssociation', to='data_refinery_common.ProcessorJob'),
),
]
2 changes: 2 additions & 0 deletions common/data_refinery_common/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,8 @@ class Dataset(models.Model):
is_processed = models.BooleanField(default=False) # Result has been made
is_available = models.BooleanField(default=False) # Result is ready for delivery

processor_jobs = models.ManyToManyField('data_refinery_common.ProcessorJob', through='ProcessorJobDataSetAssociation')

# Fail handling
success = models.NullBooleanField(null=True)
failure_reason = models.TextField()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,3 @@ def handle(self, *args, **options):
break

page = paginator.page(page.next_page_number())

# 2000 samples queued up every five minutes should be fast
# enough and also not thrash the DB.
time.sleep(60 * 5)

0 comments on commit 77b3b3d

Please sign in to comment.