Skip to content

Commit

Permalink
Merge branch 'main' into task/DES-2600--google-site-search
Browse files Browse the repository at this point in the history
  • Loading branch information
jarosenb authored Oct 25, 2023
2 parents d920665 + 384ea3d commit 5604a27
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
41 changes: 27 additions & 14 deletions designsafe/apps/auth/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
logger = logging.getLogger(__name__)


@shared_task(default_retry_delay=1*30, max_retries=3)
@shared_task(default_retry_delay=30, max_retries=3)
def check_or_create_agave_home_dir(username, systemId):
try:
# TODO should use OS calls to create directory.
Expand All @@ -35,8 +35,8 @@ def check_or_create_agave_home_dir(username, systemId):
logger.info("Creating the home directory for user=%s then going to run setfacl", username)
body = {'action': 'mkdir', 'path': username}
fm_response = ag.files.manage(systemId=systemId,
filePath='',
body=body)
filePath='',
body=body)
logger.info('mkdir response: {}'.format(fm_response))

ds_admin_client = Agave(
Expand All @@ -49,29 +49,42 @@ def check_or_create_agave_home_dir(username, systemId):
'AGAVE_SUPER_TOKEN'
),
)
job_body = {
'parameters': {
'username': username,
'directory': 'shared/{}'.format(username)
},
'name': 'setfacl',
'appId': 'setfacl_corral3-0.1'
}

if systemId == settings.AGAVE_STORAGE_SYSTEM:
job_body = {
'parameters': {
'username': username,
'directory': 'shared/{}'.format(username)
},
'name': f'setfacl mydata for user {username}',
'appId': 'setfacl_corral3-0.1'
}
elif systemId == settings.AGAVE_WORKING_SYSTEM:
job_body = {
'parameters': {
'username': username,
},
'name': f'setfacl scratch for user {username}',
'appId': 'setfacl_frontera_scratch-0.1'
}
else:
logger.error('Attempting to set permissions on unsupported system: {}'.format(systemId))
return

jobs_response = ds_admin_client.jobs.submit(body=job_body)
logger.info('setfacl response: {}'.format(jobs_response))

# add dir to index
logger.info("Indexing the home directory for user=%s", username)
agave_indexer.apply_async(kwargs={'username': username, 'systemId': systemId, 'filePath': username}, queue='indexing')

except(AgaveException):
#except (HTTPError, AgaveException):
except AgaveException:
logger.exception('Failed to create home directory.',
extra={'user': username,
'systemId': systemId})


@shared_task(default_retry_delay=1*30, max_retries=3)
@shared_task(default_retry_delay=30, max_retries=3)
def new_user_alert(username):
user = get_user_model().objects.get(username=username)
send_mail('New User in DesignSafe, need Slack', 'Username: ' + user.username + '\n' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DataDepotNavCtrl {
description: 'Private directory for your data'
},
{
name: 'Working Files (scratch Frontera)',
name: 'HPC Scratch',
collapsible: false,
state: 'myDataScratch',
description: 'Scratch directory on Frontera for use with JupyterHub'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DataDepotToolbarCtrl {
placeholder() {
var stateNames = {
'myData': 'My Data',
'myDataScratch': 'Working Files (scratch Frontera)',
'myDataScratch': 'HPC Scratch',
'projects.list': 'My Projects',
'sharedData': 'Shared Data',
'boxData': 'Box',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class WorkspaceDataBrowserCtrl {

this.options = [
{ name: 'myData', label: 'My Data' },
{ name: 'myDataScratch', label: 'Working Files (scratch Frontera)' },
{ name: 'myDataScratch', label: 'HPC Scratch' },
{ name: 'myProjects', label: 'My Projects' },
{ name: 'publications', label: 'Published' },
{ name: 'nees', label: 'Published (NEES)' },
Expand Down

0 comments on commit 5604a27

Please sign in to comment.