Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Airflow
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Margrenzo Gunawan
Airflow
Commits
5b7fbfa4
Commit
5b7fbfa4
authored
Jan 30, 2024
by
Margrenzo Gunawan
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 1_t24_interface.py
rename reversal
parent
970aef71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
1_t24_interface.py
1_t24_interface.py
+16
-1
No files found.
1_t24_interface.py
View file @
5b7fbfa4
import
json
,
os
import
csv
from
datetime
import
date
import
shutil
import
calendar
from
airflow
import
DAG
...
...
@@ -101,6 +102,16 @@ def sql_clean_syntax(ti):
def
stop_task
(
**
kwargs
):
return
True
def
rename_reversal
():
formatted_date_today
=
datetime
.
now
().
strftime
(
'%Y%m%d'
)
formatted_date_yesterday
=
yesterday_nodash
files_to_process
=
[
f'T24-FT.REVERSAL-
{
formatted_date_today
}
.csv'
,
f'T24-TT.REVERSAL-
{
formatted_date_today
}
.csv'
]
for
file_info
in
files_to_process
:
destination_path
=
f"""
{
Variable
.
get
(
"LOCAL_PATH"
)
}
t24/
{
yesterday_nodash
}
/
{
file_info
.
replace
(
formatted_date_today
,
formatted_date_yesterday
)
}
"""
source_path
=
f"""
{
Variable
.
get
(
"LOCAL_PATH"
)
}
t24/
{
yesterday_nodash
}
/
{
file_info
}
"""
print
(
"file sudah ada"
)
if
os
.
path
.
exists
(
destination_path
)
else
shutil
.
copy2
(
source_path
,
destination_path
)
with
DAG
(
"APJ_1_t24_interface"
,
start_date
=
datetime
(
2021
,
1
,
1
),
schedule_interval
=
None
,
...
...
@@ -125,6 +136,10 @@ with DAG("APJ_1_t24_interface",
)
rename_reversal
=
PythonOperator
(
task_id
=
'rename_reversal'
,
python_callable
=
rename_reversal
)
# sftp_neraca = BashOperator(
# task_id="sftp_xx",
# bash_command=f"""sshpass -p {Variable.get("SFTP_T24_PASSWORD")} sftp -o StrictHostKeyChecking=no -r {Variable.get("SFTP_T24_USER")}@{Variable.get("SFTP_T24_HOST")}:/REPORT.BP/NERACA/*{yesterday_nodash}* {Variable.get("LOCAL_PATH")}t24_neraca/{yesterday_nodash}/""",
...
...
@@ -298,4 +313,4 @@ with DAG("APJ_1_t24_interface",
)
begin
>>
sftp_xx
>>
sftp_ppap
>>
ds_list_extractor
>>
csv_clean_syntax
>>
clean_csv
>>
pg_ddl_syntax
>>
pg_create_table
>>
ds_push_syntax
>>
sql_clean_syntax
>>
ds_csv_to_table
>>
ds_clean_data
>>
stop_task
>>
ds_create_table_history_nominatif
>>
ds_to_history
>>
set_access_schemma
>>
set_access_all_table
>>
set_access_schemma_his
>>
set_access_all_table_his
>>
pentaho
>>
zip_today
>>
delete_before
>>
history_finish
begin
>>
sftp_xx
>>
sftp_ppap
>>
rename_reversal
>>
ds_list_extractor
>>
csv_clean_syntax
>>
clean_csv
>>
pg_ddl_syntax
>>
pg_create_table
>>
ds_push_syntax
>>
sql_clean_syntax
>>
ds_csv_to_table
>>
ds_clean_data
>>
stop_task
>>
ds_create_table_history_nominatif
>>
ds_to_history
>>
set_access_schemma
>>
set_access_all_table
>>
set_access_schemma_his
>>
set_access_all_table_his
>>
pentaho
>>
zip_today
>>
delete_before
>>
history_finish
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment