Fix start_forge_app in scripts (#4171)
This commit is contained in:
committed by
GitHub
parent
ae95b8dd35
commit
d22b98a381
@@ -3,7 +3,8 @@ from datetime import timedelta
|
|||||||
|
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
from skyvern.forge.app import DATABASE
|
from skyvern.forge import app
|
||||||
|
from skyvern.forge.forge_app_initializer import start_forge_app
|
||||||
from skyvern.forge.sdk.core import security
|
from skyvern.forge.sdk.core import security
|
||||||
from skyvern.forge.sdk.schemas.organizations import OrganizationAuthToken, OrganizationAuthTokenType
|
from skyvern.forge.sdk.schemas.organizations import OrganizationAuthToken, OrganizationAuthTokenType
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ async def create_org_api_token(org_id: str) -> OrganizationAuthToken:
|
|||||||
The API token created for the specified org_id.
|
The API token created for the specified org_id.
|
||||||
"""
|
"""
|
||||||
# get the organization
|
# get the organization
|
||||||
organization = await DATABASE.get_organization(org_id)
|
organization = await app.DATABASE.get_organization(org_id)
|
||||||
if not organization:
|
if not organization:
|
||||||
raise Exception(f"Organization id {org_id} not found")
|
raise Exception(f"Organization id {org_id} not found")
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ async def create_org_api_token(org_id: str) -> OrganizationAuthToken:
|
|||||||
expires_delta=API_KEY_LIFETIME,
|
expires_delta=API_KEY_LIFETIME,
|
||||||
)
|
)
|
||||||
# generate OrganizationAutoToken
|
# generate OrganizationAutoToken
|
||||||
org_auth_token = await DATABASE.create_org_auth_token(
|
org_auth_token = await app.DATABASE.create_org_auth_token(
|
||||||
organization_id=org_id,
|
organization_id=org_id,
|
||||||
token=api_key,
|
token=api_key,
|
||||||
token_type=OrganizationAuthTokenType.api,
|
token_type=OrganizationAuthTokenType.api,
|
||||||
@@ -40,6 +41,7 @@ async def create_org_api_token(org_id: str) -> OrganizationAuthToken:
|
|||||||
|
|
||||||
|
|
||||||
def main(org_id: str) -> None:
|
def main(org_id: str) -> None:
|
||||||
|
start_forge_app()
|
||||||
asyncio.run(create_org_api_token(org_id))
|
asyncio.run(create_org_api_token(org_id))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ from typing import Annotated, Optional
|
|||||||
import typer
|
import typer
|
||||||
|
|
||||||
from scripts.create_api_key import create_org_api_token
|
from scripts.create_api_key import create_org_api_token
|
||||||
from skyvern.forge.app import DATABASE
|
from skyvern.forge import app
|
||||||
|
from skyvern.forge.forge_app_initializer import start_forge_app
|
||||||
|
|
||||||
|
|
||||||
async def create_org(org_name: str, webhook_callback_url: str | None = None) -> None:
|
async def create_org(org_name: str, webhook_callback_url: str | None = None) -> None:
|
||||||
organization = await DATABASE.create_organization(org_name, webhook_callback_url)
|
organization = await app.DATABASE.create_organization(org_name, webhook_callback_url)
|
||||||
print(f"Created organization: {organization}")
|
print(f"Created organization: {organization}")
|
||||||
await create_org_api_token(organization.organization_id)
|
await create_org_api_token(organization.organization_id)
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ def main(
|
|||||||
org_name: str,
|
org_name: str,
|
||||||
webhook_callback_url: Annotated[Optional[str], typer.Argument()] = None,
|
webhook_callback_url: Annotated[Optional[str], typer.Argument()] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
start_forge_app()
|
||||||
asyncio.run(create_org(org_name, webhook_callback_url))
|
asyncio.run(create_org(org_name, webhook_callback_url))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import requests
|
|||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
from skyvern.forge import app
|
from skyvern.forge import app
|
||||||
|
from skyvern.forge.forge_app_initializer import start_forge_app
|
||||||
from skyvern.forge.sdk.schemas.tasks import TaskRequest
|
from skyvern.forge.sdk.schemas.tasks import TaskRequest
|
||||||
|
|
||||||
# Skip tests if network access is not available
|
# Skip tests if network access is not available
|
||||||
@@ -283,6 +284,8 @@ def print_help() -> None:
|
|||||||
|
|
||||||
|
|
||||||
async def main() -> None:
|
async def main() -> None:
|
||||||
|
start_forge_app()
|
||||||
|
|
||||||
print("Browser Sessions Testing CLI")
|
print("Browser Sessions Testing CLI")
|
||||||
print("Type 'help' for available commands")
|
print("Type 'help' for available commands")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user