-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#113 Added implementation for the SaaS Bucket. #116
Conversation
@@ -33,10 +33,14 @@ python = ">=3.8,<4.0" | |||
requests = ">=2.24.0" | |||
joblib=">=1.0.1" | |||
typeguard = "4.0.0" | |||
saas-api=">=0.2.0" | |||
# Temp.fix | |||
httpx=">=0.27.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the saas api also use requests?
Do we need async support? (If so we may also should migrate bucketfs to httpx at some point)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need the async support, based on the current definition of the BucketLike. May do in the future, but this is outside the scope of this ticket.
def saas_test_database_id(saas_test_service_url, saas_test_token, saas_test_account_id) -> str: | ||
|
||
with create_saas_test_client( | ||
url=saas_test_service_url, | ||
token=saas_test_token | ||
) as client: | ||
db: Optional[openapi.models.database.Database] = None | ||
try: | ||
db = create_saas_test_database( | ||
account_id=saas_test_account_id, | ||
client=client | ||
) | ||
# Wait till the database gets to the running state. | ||
sleep_time = 600 | ||
small_interval = 20 | ||
max_wait_time = 2400 | ||
max_cycles = 1 + (max_wait_time - sleep_time) // small_interval | ||
for _ in range(max_cycles): | ||
time.sleep(sleep_time) | ||
db = get_saas_database( | ||
account_id=saas_test_account_id, | ||
database_id=db.id, | ||
client=client | ||
) | ||
if db.status == SaasStatus.RUNNING: | ||
break | ||
sleep_time = 30 | ||
else: | ||
raise RuntimeError(f'Test SaaS database status is {db.status} ' | ||
f'after {max_wait_time} seconds.') | ||
yield db.id | ||
finally: | ||
if db is not None: | ||
delete_saas_database( | ||
account_id=saas_test_account_id, | ||
database_id=db.id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't the saas api provide such a fixture?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet. It will soon. At which point we may want to update this repo. However, there is a bigger problem that we may need to address - the testing of the SaaS bucket can't be done in the normal check workflow of the Python Toolbox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, based the outcome of your logger.debug("%s", "value")
vs logger.debug("{}", "value")
investigation, either update or merge.
closes #113
Submission Checklist