siliqua.work package¶
Submodules¶
siliqua.work.local module¶
-
class
siliqua.work.local.WorkPlugin(*args, **kwargs)¶ Bases:
siliqua.work.BaseWorkPlugin-
PLUGIN_NAME= 'local'¶
-
validate_config()¶ Method that validates the plugin-specific configuration and raises
siliqua.exceptions.ConfigurationErrorfor any incomplete or invalid configuration field
-
-
class
siliqua.work.local.WorkProcessor(process_count, work_lock, work_units)¶ Bases:
objectWork processor responsible for starting PoW generation on different threads and processing the results. Runs on its own thread.
-
create_pool()¶
-
get_active_workers(work_block_hash)¶
-
get_all_active_workers()¶
-
get_block_hash_workers(work_block_hash)¶
-
shutdown()¶
-
shutdown_pool()¶
-
start_work()¶ Check the pending work units and either start worker threads if work is available, or shutdown the pool entirely if no work is available
-
start_worker(work_unit)¶ Start a single worker for a work unit
- Parameters
work_unit (siliqua.work.WorkUnit) – Pending work unit
-
stop_all_workers()¶ Stop all running workers for all work units
-
stop_workers(work_block_hash)¶ Stop all running workers for the given work block hash
- Parameters
work_block_hash (str) – Work block hash
-
update()¶ Perform a single round of updates:
Check which work units need to be solved
Check which work units have been solved
Start generating PoW for pending work units
-
update_completed_blocks()¶ Check if work has been completed. Push any completed work into the queue.
-
update_pending_blocks()¶ Check the owork units for any unfinished blocks
-
-
siliqua.work.local.process_work(work_unit, shutdown_flag)¶ Try generating PoW for a work unit until PoW is generated or work plugin shutdown is triggered.
- Parameters
work_unit – Work unit to solve
shutdown_flag – Shutdown flag
-
siliqua.work.local.run_work_thread(process_count, work_lock, work_units, shutdown_flag)¶
Module contents¶
Work plugin to solve pending proof-of-work