Ctrl + K
DocumentationLog inGet started

tessl/pypi-apache-airflow-providers-ftp

tessl install tessl/pypi-apache-airflow-providers-ftp@3.13.0

Provider package for Apache Airflow that enables FTP file transfer protocol operations including hooks, operators, and sensors for workflow integration.

Agent Success

Agent success rate when using this tile

84%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.06x

Baseline

Agent success rate without this tile

79%

task.mdevals/scenario-4/

Daily Report Distribution System

Build a system that transfers multiple daily report files from a local directory to a remote FTP server in a single operation.

Requirements

Your task is to implement a function that uploads multiple report files to a remote FTP server. The system should:

  1. Accept lists of local file paths and corresponding remote destination paths
  2. Transfer all files in a single batch operation
  3. Create any missing intermediate directories on the remote server before uploading files
  4. Return information about the transferred files for tracking purposes

Function Specification

Implement a function distribute_reports that:

  • Takes an FTP connection identifier as a parameter
  • Accepts a list of local file paths (where the reports are stored locally)
  • Accepts a list of remote file paths (where the reports should be stored on the FTP server)
  • Creates intermediate directories on the remote server if they don't exist
  • Uploads all files in the batch
  • Returns the list of remote paths that were uploaded

Test Cases

  • Given local files ["/tmp/report1.csv", "/tmp/report2.csv"] and remote paths ["/reports/daily/report1.csv", "/reports/daily/report2.csv"], the function uploads both files to the remote server @test

  • Given local files ["/tmp/data.txt"] and remote paths ["/archive/2024/01/data.txt"] where the remote directory /archive/2024/01/ doesn't exist, the function creates the necessary directories and uploads the file successfully @test

  • Given mismatched list lengths (e.g., 3 local files but 2 remote paths), the function raises an appropriate error @test

Implementation

@generates

API

def distribute_reports(
    ftp_conn_id: str,
    local_filepaths: list[str],
    remote_filepaths: list[str]
) -> list[str]:
    """
    Distributes multiple report files to a remote FTP server in a batch operation.

    Args:
        ftp_conn_id: The Airflow connection ID for the FTP server
        local_filepaths: List of local file paths to upload
        remote_filepaths: List of corresponding remote destination paths

    Returns:
        List of remote file paths that were uploaded

    Raises:
        ValueError: If the lengths of local_filepaths and remote_filepaths don't match
    """
    pass

Dependencies { .dependencies }

apache-airflow-providers-ftp { .dependency }

Provides FTP operations support for Apache Airflow.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/apache-airflow-providers-ftp@3.13.x
tile.json