2022-05-10 15:11:11 -04:00
|
|
|
from crc import app
|
|
|
|
from crc.scripts.script import Script
|
|
|
|
|
|
|
|
|
|
|
|
class GetInstance(Script):
|
|
|
|
|
|
|
|
def get_description(self):
|
2022-05-17 09:59:33 -04:00
|
|
|
return """Get the name of the current instance, using the INSTANCE_NAME environment variable."""
|
2022-05-10 15:11:11 -04:00
|
|
|
|
|
|
|
def do_task_validate_only(self, task, study_id, workflow_id, *args, **kwargs):
|
|
|
|
return self.do_task(task, study_id, workflow_id, *args, **kwargs)
|
|
|
|
|
|
|
|
def do_task(self, task, study_id, workflow_id, *args, **kwargs):
|
2022-05-17 09:59:33 -04:00
|
|
|
if 'INSTANCE_NAME' in app.config:
|
|
|
|
return app.config['INSTANCE_NAME']
|
2022-05-10 15:11:11 -04:00
|
|
|
# TODO: Not sure what we should do here
|
2022-05-17 09:59:33 -04:00
|
|
|
app.logger.info('no_instance_name: INSTANCE_NAME not configured for this server.')
|
2022-05-10 15:11:11 -04:00
|
|
|
return ''
|