Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
1c0fac86
Commit
1c0fac86
authored
7 years ago
by
Harsha Kethineni
Browse files
Options
Downloads
Patches
Plain Diff
Added more testing and fixed the testing closure for enumerate to start from 1
parent
3386dbc8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/database.py
+6
-3
6 additions, 3 deletions
bin/database.py
with
6 additions
and
3 deletions
bin/database.py
+
6
−
3
View file @
1c0fac86
...
...
@@ -966,6 +966,7 @@ def upgrade_to_26_closure(job):
gear_name
=
gear
[
'
gear
'
][
'
name
'
]
# Checks if the specific gear tag already exists for the job
# Redundant now that cursor only finds jobs without the tags
# for tag in job['tags']:
# if tag == gear_name:
# return True
...
...
@@ -978,7 +979,8 @@ def upgrade_to_26_closure(job):
def
upgrade_to_26_test_closure
(
job
):
for
count
,
tag
in
enumerate
(
job
[
'
tags
'
]):
for
count
,
tag
in
enumerate
(
job
[
'
tags
'
],
1
):
logging
.
info
(
count
)
if
count
>
2
:
raise
Exception
(
"
Job has multiple gear tags
"
)
return
True
...
...
@@ -989,7 +991,8 @@ def upgrade_to_26():
Add job tags back to the job document, and use a faster cursor-walking update method
"""
for
i
in
range
(
20
):
config
.
db
.
jobs
.
insert_one
({
'
tags
'
:
[
'
auto
'
],
'
gear_id
'
:
"
591cd19404bfcf0020d8cacf
"
})
cursor
=
config
.
db
.
jobs
.
find
({
'
tags[1]
'
:
{
'
$exists
'
:
True
}})
process_cursor
(
cursor
,
upgrade_to_26_closure
)
for
i
in
range
(
4
):
...
...
@@ -997,7 +1000,7 @@ def upgrade_to_26():
cursor
=
config
.
db
.
jobs
.
find
({})
process_cursor
(
cursor
,
upgrade_to_26_test_closure
)
# raise Exception("Successful upgrade to 26"
)
config
.
db
.
jobs
.
remove
(
)
def
upgrade_to_27
():
...
...
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