def check_numerai_validity(key_id, secret): try: napi = numerapi.NumerAPI(key_id, secret) napi.get_account() except Exception: raise exception_with_msg("Numerai keys seem to be invalid. " "Make sure you've entered them correctly.")
def check_aws_validity(key_id, secret): try: client = boto3.client('s3', aws_access_key_id=key_id, aws_secret_access_key=secret) client.list_buckets() except Exception as e: if 'NotSignedUp' in str(e): raise exception_with_msg( f"Your AWS keys are valid, but the account is not finished signing up. " f"You either need to update your credit card in AWS at " f"https://portal.aws.amazon.com/billing/signup?type=resubscribe#/resubscribed, " f"or wait up to 24 hours for their verification process to complete." ) raise exception_with_msg( f"AWS keys seem to be invalid. Make sure you've entered them correctly " f"and that your user has the necessary permissions (for help, see " f"https://github.com/numerai/numerai-cli/wiki/Amazon-Web-Services)." )
def monitor(node, config, verbose, num_lines, log_type, follow_tail): if log_type not in LOG_TYPES: raise exception_with_msg(f"Unknown log type '{log_type}', " f"must be one of {LOG_TYPES}") if config['provider'] == PROVIDER_AWS: monitor_aws(node, config, num_lines, log_type, follow_tail, verbose) else: click.secho(f"Unsupported provider: '{config['provider']}'", fg='red') return
def get_name_and_print_logs(logs_client, family, limit, next_token=None, raise_on_error=True): streams = logs_client.describe_log_streams(logGroupName=family, orderBy="LastEventTime", descending=True) if len(streams['logStreams']) == 0: if not raise_on_error: return False raise exception_with_msg( "No logs found. Make sure the webhook has triggered by checking " "`numerai node status` and make sure a task is in the RUNNING state " "(this can take a few minutes). Also, make sure your webhook has " "triggered at least once by running `numerai node test`") name = streams['logStreams'][0]['logStreamName'] print_logs(logs_client, family, name, limit, next_token) return True