Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Amazon-Selection-Data
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abel_cjy
Amazon-Selection-Data
Commits
27088859
Commit
27088859
authored
Jun 06, 2025
by
wujicang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改导出参数
parent
42821c6d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
self_asin_redis.py
Pyspark_job/export_other/self_asin_redis.py
+9
-0
No files found.
Pyspark_job/export_other/self_asin_redis.py
View file @
27088859
...
@@ -123,10 +123,13 @@ def save_to_doris(df_all: DataFrame):
...
@@ -123,10 +123,13 @@ def save_to_doris(df_all: DataFrame):
def
export
():
def
export
():
spark
=
SparkUtil
.
get_spark_session
(
"self_asin_redis:export"
)
spark
=
SparkUtil
.
get_spark_session
(
"self_asin_redis:export"
)
day
=
CommonUtil
.
get_sys_arg
(
1
,
CommonUtil
.
format_now
(
"
%
Y-
%
m-
%
d"
))
day
=
CommonUtil
.
get_sys_arg
(
1
,
CommonUtil
.
format_now
(
"
%
Y-
%
m-
%
d"
))
export_type
=
CommonUtil
.
get_sys_arg
(
2
,
"redis&&doris"
)
last_day
=
CommonUtil
.
get_day_offset
(
day
,
-
1
)
last_day
=
CommonUtil
.
get_day_offset
(
day
,
-
1
)
next_day
=
CommonUtil
.
get_day_offset
(
day
,
1
)
next_day
=
CommonUtil
.
get_day_offset
(
day
,
1
)
# 先删除
# 先删除
redis_key
=
f
"self_asin_detail:{day}"
redis_key
=
f
"self_asin_detail:{day}"
if
"redis"
in
export_type
:
client
=
RedisUtils
.
get_redis_client_by_type
(
db_type
=
'microservice'
)
client
=
RedisUtils
.
get_redis_client_by_type
(
db_type
=
'microservice'
)
if
client
.
exists
(
redis_key
):
if
client
.
exists
(
redis_key
):
client
.
delete
(
redis_key
)
client
.
delete
(
redis_key
)
...
@@ -177,11 +180,17 @@ def export():
...
@@ -177,11 +180,17 @@ def export():
# 填充默认值
# 填充默认值
asin_df
=
na_fill
(
asin_df
)
.
cache
()
asin_df
=
na_fill
(
asin_df
)
.
cache
()
if
"redis"
in
export_type
:
asin_df
.
toJSON
()
.
foreachPartition
(
functools
.
partial
(
save_to_redis_list
,
batch
=
5000
,
redis_key
=
redis_key
,
ttl
=
3600
*
24
))
asin_df
.
toJSON
()
.
foreachPartition
(
functools
.
partial
(
save_to_redis_list
,
batch
=
5000
,
redis_key
=
redis_key
,
ttl
=
3600
*
24
))
print
(
f
"{site_name}:redis:success"
)
print
(
f
"{site_name}:redis:success"
)
if
"doris"
in
export_type
:
save_to_doris
(
asin_df
)
save_to_doris
(
asin_df
)
print
(
f
"{site_name}:doris:success"
)
print
(
f
"{site_name}:doris:success"
)
print
(
"success all"
)
print
(
"success all"
)
if
"redis"
in
export_type
:
check_total
()
check_total
()
pass
pass
...
...
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