Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/opengradient/client/alpha.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import base64
import logging
import json
import urllib.parse
from typing import Dict, List, Optional, Union
Expand All @@ -21,6 +22,8 @@
from ._conversions import convert_array_to_model_output, convert_to_model_input, convert_to_model_output # type: ignore[attr-defined]
from ._utils import get_abi, get_bin, run_with_retry

logger = logging.getLogger(__name__)

DEFAULT_RPC_URL = "https://ogevmdevnet.opengradient.ai"
DEFAULT_API_URL = "https://sdk-devnet.opengradient.ai"
DEFAULT_INFERENCE_CONTRACT_ADDRESS = "0x8383C9bD7462F12Eb996DD02F78234C0421A6FaE"
Expand Down Expand Up @@ -299,9 +302,8 @@ def deploy_transaction():
estimated_gas = contract.constructor(*constructor_args).estimate_gas({"from": self._wallet_account.address})
gas_limit = int(estimated_gas * 1.2)
except Exception as e:
print(f"Gas estimation failed: {str(e)}")
logger.warning("Gas estimation failed: %s. Using conservative fallback gas limit of 5,000,000.", e)
gas_limit = 5000000 # Conservative fallback
print(f"Using fallback gas limit: {gas_limit}")

transaction = contract.constructor(*constructor_args).build_transaction(
{
Expand Down Expand Up @@ -369,8 +371,12 @@ def _register_with_scheduler(self, contract_address: str, scheduler_params: Sche
scheduler_tx_hash = self._blockchain.eth.send_raw_transaction(signed_scheduler_tx.raw_transaction)
self._blockchain.eth.wait_for_transaction_receipt(scheduler_tx_hash, timeout=REGULAR_TX_TIMEOUT)
except Exception as e:
print(f"Error registering contract with scheduler: {str(e)}")
print(" The workflow contract is still deployed and can be executed manually.")
logger.warning(
"Failed to register workflow contract %s with scheduler: %s. "
"The contract is still deployed and can be executed manually.",
contract_address,
e,
)

def read_workflow_result(self, contract_address: str) -> ModelOutput:
"""
Expand Down
Loading