예제 #1
0
def new(name, project, workflow, last_id, caesar_name, sqs_queue,
        staging, auth_mode):
    """
    Generate new configuration for a project.

    \b
    Arguments
    ---------
    name - Arbitrary name used to store configuration
    project - Zooniverse project id
    workflow - Zooniverse workflow id
    """

    kwargs = {
        'name': name,
        'project': project,
        'workflow': workflow,
        'last_id': last_id,
        'sqs_queue' : sqs_queue,
        'staging_mode' : staging,
    }

    if auth_mode == 'api_key':
        kwargs.update({
            'client_id': os.environ.get('PANOPTES_CLIENT_ID'),
            'client_secret': os.environ.get('PANOPTES_CLIENT_SECRET')
        })

    if caesar_name is not None:
        kwargs.update({'caesar_name': caesar_name})

    config = Config(**kwargs)
    config.save()
예제 #2
0
def new(name, project, workflow, last_id, caesar_name, sqs_queue=None, staging_mode=False, client_id=None, client_secret=None):
    kwargs = {
        'name': name,
        'project': project,
        'workflow': workflow,
        'last_id': last_id,
        'sqs_queue' : sqs_queue,
        'staging_mode' : staging_mode,
        'client_id' : client_id,
        'client_secret' : client_secret
    }
    if caesar_name is not None:
        kwargs.update({'caesar_name': caesar_name})

    config = Config(**kwargs)
    config.save()