Skip to content

Commit

Permalink
Update test data
Browse files Browse the repository at this point in the history
  • Loading branch information
mkzia committed Jul 26, 2019
1 parent f4f8133 commit d0d4ced
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 66 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ pip install -r requirements.txt
```
cp coldfront/config/local_settings.py.sample coldfront/config/local_settings.py
```
Open coldfront/config/local_settings.py and update the following:
* Update `SECRET_KEY`. Consider making the length at least 50 characters long.
* Update `TIME_ZONE` if necessary
* Uncomment `CENTER_NAME` and update it

5. Copy config/local_strings.py.sample to config/local_strings.py and update if desired.
```
Expand All @@ -79,7 +75,7 @@ cp coldfront/config/local_strings.py.sample coldfront/config/local_strings.py
python manage.py initial_setup
```

7. Optional: Add some test data
7. OPTIONAL: Add some test data
```
python manage.py load_test_data
```
Expand Down
10 changes: 5 additions & 5 deletions coldfront/config/local_settings.py.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Here you can define custom database settings, add authentication backends,
configure logging, and ColdFront plugins.
"""
#------------------------------------------------------------------------------
# Secret Key (required set to something long and random)
# Secret Key -- Generate new key using: https://www.miniwebtool.com/django-secret-key-generator/
#------------------------------------------------------------------------------
SECRET_KEY = ''
SECRET_KEY = 'vtri&lztlbinerr4+yg1yzm23ez@+ub6=4*63z1%d!)fg(g4x$' # UPDATE

#------------------------------------------------------------------------------
# Enable debugging. WARNING: These should be set to False in production
Expand All @@ -24,7 +24,7 @@ SESSION_COOKIE_SECURE = False
#------------------------------------------------------------------------------
# General Center Information
#------------------------------------------------------------------------------
# CENTER_NAME = 'HPC Resources'
CENTER_NAME = 'HPC Resources'
# CENTER_HELP_URL = 'http://localhost/help'
# CENTER_PROJECT_RENEWAL_HELP_URL = 'http://localhost/help'
# CENTER_BASE_URL = 'https://coldfront.io'
Expand Down Expand Up @@ -72,7 +72,7 @@ LOGGING = {
#------------------------------------------------------------------------------
# Enable Project Review
#------------------------------------------------------------------------------
PROJECT_ENABLE_PROJECT_REVIEW = False
PROJECT_ENABLE_PROJECT_REVIEW = True

#------------------------------------------------------------------------------
# Allocation related
Expand Down Expand Up @@ -146,7 +146,7 @@ LOCAL_SETTINGS_EXPORT = []
#------------------------------------------------------------------------------
# Enable administrators to login as other users
#------------------------------------------------------------------------------
# EXTRA_AUTHENTICATION_BACKENDS += ['django_su.backends.SuBackend',]
EXTRA_AUTHENTICATION_BACKENDS += ['django_su.backends.SuBackend',]

#------------------------------------------------------------------------------
# Example config for enabling LDAP user authentication using django-auth-ldap.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ def handle(self, *args, **options):
AttributeType.objects.get_or_create(name=attribute_type)

for resource_attribute_type, attribute_type in (
('Access', 'Public/Private'),
('AllowedGroups', 'Text'),
('Core Count', 'Int'),
('expiry_time', 'Int'),
('fee_applies', 'Yes/No'),
Expand Down
109 changes: 55 additions & 54 deletions coldfront/core/utils/management/commands/load_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ def handle(self, *args, **options):
description='We want to estimate the quark chemical potential of a rotating sample of plasma.',
field_of_science=FieldOfScience.objects.get(
description='Chemistry'),
status=ProjectStatusChoice.objects.get(name='Active')
status=ProjectStatusChoice.objects.get(name='Active'),
force_review=True
)

univ_hpc = Resource.objects.get(name='University HPC')
Expand All @@ -198,56 +199,56 @@ def handle(self, *args, **options):
univ_hpc.linked_resources.add(resource_obj)
univ_hpc.save()

publication_source = PublicationSource.objects.get(name='doi')
for title, author, year, unique_id, source in (
('Angular momentum in QGP holography', 'Brett McInnes',
2014, '10.1016/j.nuclphysb.2014.08.011', 'doi'),
('Robust ferroelectric state in multiferroicMn1-xZnxWO4',
'R. P. Chaudhury and F. Ye and J. A. Fernandez-Baca and B. Lorenz and Y. Q. Wang and Y. Y. Sun and H. A. Mook and C. W. Chu',
2011,
'10.1103/PhysRevB.83.014401',
'doi'
),
('Extreme sensitivity of a frustrated quantum magnet:Cs2CuCl4',
'Oleg A. Starykh and Hosho Katsura and Leon Balents',
2010,
'10.1103/PhysRevB.82.014421',
'doi'
),
('Magnetic excitations in the spinel compoundLix[Mn1.96Li0.04]O4(x=0.2,0.6,0.8,1.0): How a classical system can mimic quantum critical scaling',
'Thomas Heitmann and Alexander Schmets and John Gaddy and Jagat Lamsal and Marcus Petrovic and Thomas Vojta and Wouter Montfrooij',
2010,
'10.1103/PhysRevB.81.014411',
'doi'
),
):
Publication.objects.get_or_create(
project=project_obj,
title=title,
author=author,
year=year,
unique_id=unique_id,
source=publication_source
)

start_date = datetime.datetime.now()
end_date = datetime.datetime.now() + relativedelta(days=900)

Grant.objects.get_or_create(
project=project_obj,
title='Angular momentum in QGP holography',
grant_number='12345',
role='CoPI',
grant_pi_full_name='John Doe',
funding_agency=GrantFundingAgency.objects.get(
name='National Science Foundation (NSF)'),
grant_start=start_date,
grant_end=end_date,
percent_credit=20.0,
direct_funding=600000.0,
total_amount_awarded=3000000.0,
status=GrantStatusChoice.objects.get(name='Active')
)
# publication_source = PublicationSource.objects.get(name='doi')
# for title, author, year, unique_id, source in (
# ('Angular momentum in QGP holography', 'Brett McInnes',
# 2014, '10.1016/j.nuclphysb.2014.08.011', 'doi'),
# ('Robust ferroelectric state in multiferroicMn1-xZnxWO4',
# 'R. P. Chaudhury and F. Ye and J. A. Fernandez-Baca and B. Lorenz and Y. Q. Wang and Y. Y. Sun and H. A. Mook and C. W. Chu',
# 2011,
# '10.1103/PhysRevB.83.014401',
# 'doi'
# ),
# ('Extreme sensitivity of a frustrated quantum magnet:Cs2CuCl4',
# 'Oleg A. Starykh and Hosho Katsura and Leon Balents',
# 2010,
# '10.1103/PhysRevB.82.014421',
# 'doi'
# ),
# ('Magnetic excitations in the spinel compoundLix[Mn1.96Li0.04]O4(x=0.2,0.6,0.8,1.0): How a classical system can mimic quantum critical scaling',
# 'Thomas Heitmann and Alexander Schmets and John Gaddy and Jagat Lamsal and Marcus Petrovic and Thomas Vojta and Wouter Montfrooij',
# 2010,
# '10.1103/PhysRevB.81.014411',
# 'doi'
# ),
# ):
# Publication.objects.get_or_create(
# project=project_obj,
# title=title,
# author=author,
# year=year,
# unique_id=unique_id,
# source=publication_source
# )

# start_date = datetime.datetime.now()
# end_date = datetime.datetime.now() + relativedelta(days=900)

# Grant.objects.get_or_create(
# project=project_obj,
# title='Angular momentum in QGP holography',
# grant_number='12345',
# role='CoPI',
# grant_pi_full_name='John Doe',
# funding_agency=GrantFundingAgency.objects.get(
# name='National Science Foundation (NSF)'),
# grant_start=start_date,
# grant_end=end_date,
# percent_credit=20.0,
# direct_funding=600000.0,
# total_amount_awarded=3000000.0,
# status=GrantStatusChoice.objects.get(name='Active')
# )

project_user_obj, _ = ProjectUser.objects.get_or_create(
user=pi1,
Expand Down Expand Up @@ -296,7 +297,7 @@ def handle(self, *args, **options):
project=project_obj,
status=AllocationStatusChoice.objects.get(name='Active'),
start_date=start_date,
end_date=end_date,
end_date=datetime.datetime.now() + relativedelta(days=10),
justification='I need access to university cluster.'
)

Expand Down Expand Up @@ -330,14 +331,14 @@ def handle(self, *args, **options):
AllocationAttribute.objects.get_or_create(
allocation_attribute_type=allocation_attribute_type_obj,
allocation=allocation_obj,
value='yes')
value='Yes')

allocation_attribute_type_obj = AllocationAttributeType.objects.get(
name='SupportersQOSExpireDate')
AllocationAttribute.objects.get_or_create(
allocation_attribute_type=allocation_attribute_type_obj,
allocation=allocation_obj,
value='10/9/2022')
value='2022-01-01')

allocation_user_obj = AllocationUser.objects.create(
allocation=allocation_obj,
Expand Down

0 comments on commit d0d4ced

Please sign in to comment.