Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devadutta/92af8abed492254a530dfd3a55c0c684 to your computer and use it in GitHub Desktop.
Save devadutta/92af8abed492254a530dfd3a55c0c684 to your computer and use it in GitHub Desktop.
getTranscoderState(worker.PuK):
# The call fails if the worker is not registered else returns
# one of the following states.
# enum TranscoderState { BONDING, BONDED, UNBONDED, UNBONDING }
worker.stakeReady is equal to BONDED state. The current implementation allows delegation in any of the states.
onlineWorkers = select online workers \
where worker.directStake > minDirectStake \
AND getTranscoderState(worker.PuK) == BONDED
for worker in onlineWorkers:
if worker.encodeCapacity > profile.minimumEncodeCapacity
and
worker.currentCPU < profile.maxCurrentCPU
# other selection criteria can come here later
qualifiedWorkers.append(worker)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment