Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
meanspec-hwinfo-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MeanSpec (SCE338 2024-2 Group 1)
meanspec-hwinfo-daemon
Commits
df098acf
Verified
Commit
df098acf
authored
6 months ago
by
Eunhak Lee
Browse files
Options
Downloads
Patches
Plain Diff
feat: transaction 테이블도 채움
parent
bee4bf1b
No related branches found
No related tags found
No related merge requests found
Pipeline
#10670
passed
6 months ago
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
push_to_db.py
+12
-0
12 additions, 0 deletions
push_to_db.py
with
12 additions
and
0 deletions
push_to_db.py
+
12
−
0
View file @
df098acf
...
...
@@ -107,6 +107,11 @@ def match_part_obj_into_db(_part, part_type):
return
_matched_id
def
finalize_transaction
(
_cursor
,
_transaction_id
,
_user_id
,
_combination_id
):
_cursor
.
execute
(
"
INSERT INTO transactions (id, user_id, combination_id) VALUES (%s, %s, %s);
"
,
_transaction_id
,
_user_id
,
_combination_id
)
_cursor
.
fetchall
()
def
func
():
value
=
R
.
lpop
(
"
mypc:queue
"
)
if
value
is
None
:
...
...
@@ -179,6 +184,13 @@ def func():
print
(
"
Committing to DB
"
)
db_conn
.
commit
()
print
(
"
Finalizing transaction
"
)
with
db_conn
.
cursor
()
as
cursor
:
finalize_transaction
(
cursor
,
_transaction_id
,
_user_id
,
_combination_id
)
print
(
"
Committing to DB
"
)
db_conn
.
commit
()
print
(
"
Removing anchor key from Redis
"
)
R
.
delete
(
f
"
mypc:code:
{
code
}
:document
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment