def export_receipts_and_logs_command(execution_date, provider_uri, **kwargs):
        with TemporaryDirectory() as tempdir:
            copy_from_export_path(
                export_path("transactions", execution_date), os.path.join(tempdir, "transactions.csv")
            )

            logging.info('Calling extract_csv_column(...)')
            extract_csv_column.callback(
                input=os.path.join(tempdir, "transactions.csv"),
                output=os.path.join(tempdir, "transaction_hashes.txt"),
                column="hash",
            )

            logging.info('Calling export_receipts_and_logs({}, ..., {}, {}, ...)'.format(
                export_batch_size, provider_uri, export_max_workers))
            export_receipts_and_logs.callback(
                batch_size=export_batch_size,
                transaction_hashes=os.path.join(tempdir, "transaction_hashes.txt"),
                provider_uri=provider_uri,
                max_workers=export_max_workers,
                receipts_output=os.path.join(tempdir, "receipts.csv"),
                logs_output=os.path.join(tempdir, "logs.json"),
            )

            copy_to_export_path(
                os.path.join(tempdir, "receipts.csv"), export_path("receipts", execution_date)
            )
            copy_to_export_path(os.path.join(tempdir, "logs.json"), export_path("logs", execution_date))
Ejemplo n.º 2
0
    def export_contracts_command(execution_date, **kwargs):
        with TemporaryDirectory() as tempdir:
            copy_from_export_path(export_path("receipts", execution_date),
                                  os.path.join(tempdir, "receipts.csv"))

            logging.info('Calling extract_csv_column(...)')
            extract_csv_column.callback(
                input=os.path.join(tempdir, "receipts.csv"),
                output=os.path.join(tempdir, "contract_addresses.txt"),
                column="contract_address",
            )

            logging.info('Calling export_contracts({}, ..., {}, {})'.format(
                export_batch_size, export_max_workers, web3_provider_uri))
            export_contracts.callback(
                batch_size=export_batch_size,
                contract_addresses=os.path.join(tempdir,
                                                "contract_addresses.txt"),
                output=os.path.join(tempdir, "contracts.json"),
                max_workers=export_max_workers,
                provider_uri=web3_provider_uri,
            )

            copy_to_export_path(os.path.join(tempdir, "contracts.json"),
                                export_path("contracts", execution_date))