Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
strategy_embedding
Project
Project
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
rank
strategy_embedding
Commits
42d5aeb3
Commit
42d5aeb3
authored
Oct 28, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get tractate data
parent
ecaf570c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
date.py
utils/date.py
+0
-10
tractate.py
word_vector/tractate.py
+13
-2
No files found.
utils/date.py
deleted
100644 → 0
View file @
ecaf570c
from
datetime
import
date
,
timedelta
def
get_ndays_before_with_format
(
n
,
format
):
yesterday
=
(
date
.
today
()
+
timedelta
(
days
=-
n
))
.
strftime
(
format
)
return
yesterday
def
get_ndays_before_no_minus
(
n
):
return
get_ndays_before_with_format
(
n
,
"
%
Y
%
m
%
d"
)
word_vector/tractate.py
View file @
42d5aeb3
from
datetime
import
date
,
timedelta
from
pyspark
import
SparkConf
from
pyspark.sql
import
SparkSession
from
pytispark
import
pytispark
as
pti
def
get_ndays_before_with_format
(
n
,
format
):
yesterday
=
(
date
.
today
()
+
timedelta
(
days
=-
n
))
.
strftime
(
format
)
return
yesterday
def
get_ndays_before_no_minus
(
n
):
return
get_ndays_before_with_format
(
n
,
"
%
Y
%
m
%
d"
)
def
get_spark
(
app_name
=
""
):
sparkConf
=
SparkConf
()
sparkConf
.
set
(
"spark.sql.crossJoin.enabled"
,
True
)
...
...
@@ -18,8 +29,8 @@ def get_spark(app_name=""):
"spark.sql.extensions"
,
"org.apache.spark.sql.TiExtensions"
)
.
config
(
"spark.tispark.pd.addresses"
,
"172.16.40.170:2379"
)
.
appName
(
app_name
)
.
enableHiveSupport
()
.
getOrCreate
()
sc
=
spark
.
sparkContext
sc
.
addPyFile
(
"/srv/apps/strategy_embedding/utils/date.py"
)
#
sc = spark.sparkContext
#
sc.addPyFile("/srv/apps/strategy_embedding/utils/date.py")
ti
=
pti
.
TiContext
(
spark
)
ti
.
tidbMapDatabase
(
"jerry_test"
)
return
spark
...
...
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