Testing and Running UDF
Before deploying your UDF, it's important to test it to ensure it works as expected.
Unit Tests
Write unit tests for your processing logic:
import unittest from your_udf_jobs import YourCustomJob from hemera.dataclasses import Transaction
class TestYourCustomJob(unittest.TestCase):
Integration Tests
Run the indexer with your UDF in a test environment:
Use a test blockchain network (e.g., Ganache, or a testnet) to provide blockchain data.
Use a test database to avoid affecting production data.
Run the indexer and verify that your UDF processes data correctly and stores it in the database.
Running the hemera indexer with UDFs
Once you've tested your UDF, you can deploy it as part of the Hemera Indexer in your production environment.
Steps to Running
Ensure Code is in the Correct Location: Place your UDF code in the appropriate directories within the Hemera Indexer project.
Update Configuration: Make sure any configuration files or scripts include your UDF.
Update Database: Apply any new database migrations.
Restart the Indexer: Restart the Hemera Indexer to pick up the new UDF.
Using Docker
If you're using Docker to run Hemera Indexer:
Update the Docker Image: Include your UDF code in the Docker image.
Rebuild the Image:
Restart the Containers:
Running from Source
Install development tools as specified in the Hemera documentation.
Prepare PostgreSQL and other dependencies.
Run Hemera directly:
For more detailed setup and deployment options, refer to the Installation section.
Last updated