Skip to content

Commit

Permalink
Add method to get jobs count from TEE pool contract (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
volod-vana authored Nov 4, 2024
1 parent 9cc0be6 commit 9156508
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "vana"
version = "0.22.0"
version = "0.23.0"
description = ""
authors = ["Tim Nunamaker <[email protected]>", "Volodymyr Isai <[email protected]>", "Kahtaf Alam <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion vana/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

__version__ = "0.22.0"
__version__ = "0.23.0"

import rich

Expand Down
17 changes: 17 additions & 0 deletions vana/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,20 @@ def claim(self):
"""
claim_fn = self.tee_pool_contract.functions.claim()
return self.chain_manager.send_transaction(claim_fn, self.wallet.hotkey)

def get_jobs_count(self) -> int:
"""
Get the total number of jobs from the TEE Pool contract
Returns:
int: Total number of jobs in the queue
"""
try:
# Call the TEE Pool contract's jobCount method
job_count_fn = self.tee_pool_contract.functions.jobsCount()
job_count = self.chain_manager.read_contract_fn(job_count_fn)
return job_count
except Exception as e:
vana.logging.error(f"Error getting job count: {str(e)}")
# Return 0 if unable to get count to avoid breaking progress calculation
return 0

0 comments on commit 9156508

Please sign in to comment.