You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/02 18:55:37 UTC

[GitHub] [airflow] o-nikolas commented on a diff in pull request #26974: Add `FTPFileTransmitOperator`

o-nikolas commented on code in PR #26974:
URL: https://github.com/apache/airflow/pull/26974#discussion_r1038436706


##########
tests/system/providers/ftp/example_ftp.py:
##########
@@ -0,0 +1,63 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+This is an example dag for using the FTPFileTransmitOperator.
+"""
+from __future__ import annotations
+
+import os
+from datetime import datetime
+
+from airflow import DAG
+from airflow.providers.ftp.operators.ftp import FTPFileTransmitOperator, FTPOperation
+
+ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
+DAG_ID = "example_ftp_put_get"
+
+with DAG(
+    DAG_ID,
+    schedule_interval="@once",
+    start_date=datetime(2021, 1, 1),
+    catchup=False,
+    tags=["example", "Ftp", "FtpFileTransmit"],
+) as dag:
+    # [START howto_operator_ftp_put]
+    ftp_put = FTPFileTransmitOperator(
+        task_id="test_ftp_put",
+        ftp_conn_id="ftp_default",
+        local_filepath="/tmp/filepath",
+        remote_filepath="/remote_tmp/filepath",
+        operation=FTPOperation.PUT,
+        create_intermediate_dirs=True,
+    )
+    # [END howto_operator_ftp_put]
+
+    # [START howto_operator_ftp_get]
+    ftp_get = FTPFileTransmitOperator(
+        task_id="test_ftp_get",
+        ftp_conn_id="ftp_default",
+        local_filepath="/tmp/filepath",
+        remote_filepath="/remote_tmp/filepath",
+        operation=FTPOperation.GET,
+        create_intermediate_dirs=True,
+    )
+    # [END howto_operator_ftp_get]
+

Review Comment:
   I know you don't have any teardown tasks here, but I'd prefer that you still add the watcher task and a task chain, just to match other AIP-47 spec tests and so that future additions are more straightforward 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org