Skip to content

Commit

Permalink
feat: timer
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Jul 22, 2023
1 parent fd2f042 commit 4644260
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/debug_apy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import os
import sys
import time
import logging
import os
import traceback
Expand All @@ -8,12 +11,14 @@

def main(address):
from yearn.apy.common import get_samples
start = time.perf_counter()
from yearn.v2.registry import Registry
from yearn.v2.vaults import Vault
registry = Registry()
vault = Vault.from_address(address)
vault.registry = registry
print(await_awaitable(vault.apy(get_samples())))
logger.info(f'apy {str(await_awaitable(vault.apy(get_samples())))}')
logger.info(f' ⏱️ {time.perf_counter() - start} seconds')

def with_exception_handling():
address = os.getenv("DEBUG_ADDRESS", None)
Expand All @@ -31,3 +36,6 @@ def with_exception_handling():
logger.info("*** Available variables for debugging ***")
available_variables = [ k for k in locals().keys() if '__' not in k and 'pdb' not in k and 'self' != k and 'sys' != k ]
logger.info(available_variables)

if __name__ == '__main__':
globals()[sys.argv[1]]()

0 comments on commit 4644260

Please sign in to comment.