Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
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
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Commits
6e26e3f7
Commit
6e26e3f7
authored
4 years ago
by
Henrik tom Wörden
Committed by
Florian Spreckelsen
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: logging in loadfiles and static authorization function
parent
335b7bc7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!22
Release 0.3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosadvancedtools/crawler.py
+7
-2
7 additions, 2 deletions
src/caosadvancedtools/crawler.py
src/caosadvancedtools/loadFiles.py
+7
-5
7 additions, 5 deletions
src/caosadvancedtools/loadFiles.py
with
14 additions
and
7 deletions
src/caosadvancedtools/crawler.py
+
7
−
2
View file @
6e26e3f7
...
@@ -118,7 +118,8 @@ class Crawler(object):
...
@@ -118,7 +118,8 @@ class Crawler(object):
"""
generates items to be crawled with an index
"""
"""
generates items to be crawled with an index
"""
yield
0
,
None
yield
0
,
None
def
update_authorized_changes
(
self
,
run_id
):
@staticmethod
def
update_authorized_changes
(
run_id
):
"""
"""
execute the pending updates of a specific run id.
execute the pending updates of a specific run id.
...
@@ -128,7 +129,8 @@ class Crawler(object):
...
@@ -128,7 +129,8 @@ class Crawler(object):
-----------
-----------
run_id: the id of the crawler run
run_id: the id of the crawler run
"""
"""
changes
=
self
.
update_cache
.
get_updates
(
run_id
)
cache
=
UpdateCache
()
changes
=
cache
.
get_updates
(
run_id
)
for
_
,
_
,
old
,
new
,
_
in
changes
:
for
_
,
_
,
old
,
new
,
_
in
changes
:
current
=
db
.
Container
()
current
=
db
.
Container
()
...
@@ -147,6 +149,9 @@ class Crawler(object):
...
@@ -147,6 +149,9 @@ class Crawler(object):
continue
continue
new_cont
.
update
(
unique
=
False
)
new_cont
.
update
(
unique
=
False
)
logger
.
info
(
"
Successfully updated {} records!
"
.
format
(
len
(
new_cont
)))
logger
.
info
(
"
Finished with authorized updates.
"
)
def
collect_cfoods
(
self
):
def
collect_cfoods
(
self
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
src/caosadvancedtools/loadFiles.py
+
7
−
5
View file @
6e26e3f7
...
@@ -24,12 +24,14 @@
...
@@ -24,12 +24,14 @@
#
#
import
argparse
import
argparse
import
logging
import
math
import
math
import
sys
import
sys
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
import
caosdb
as
db
import
caosdb
as
db
logger
=
logging
.
getLogger
(
__name__
)
timeout_fallback
=
20
timeout_fallback
=
20
...
@@ -37,8 +39,8 @@ def convert_size(size):
...
@@ -37,8 +39,8 @@ def convert_size(size):
if
(
size
==
0
):
if
(
size
==
0
):
return
'
0B
'
return
'
0B
'
size_name
=
(
"
B
"
,
"
KB
"
,
"
MB
"
,
"
GB
"
,
"
TB
"
,
"
PB
"
,
"
EB
"
,
"
ZB
"
,
"
YB
"
)
size_name
=
(
"
B
"
,
"
KB
"
,
"
MB
"
,
"
GB
"
,
"
TB
"
,
"
PB
"
,
"
EB
"
,
"
ZB
"
,
"
YB
"
)
i
=
int
(
math
.
floor
(
math
.
log
(
size
,
10
24
)))
i
=
int
(
math
.
floor
(
math
.
log
(
size
,
10
00
)))
p
=
math
.
pow
(
10
24
,
i
)
p
=
math
.
pow
(
10
00
,
i
)
s
=
round
(
size
/
p
,
2
)
s
=
round
(
size
/
p
,
2
)
return
'
%s %s
'
%
(
s
,
size_name
[
i
])
return
'
%s %s
'
%
(
s
,
size_name
[
i
])
...
@@ -47,7 +49,7 @@ def convert_size(size):
...
@@ -47,7 +49,7 @@ def convert_size(size):
def
loadpath
(
path
,
include
,
exclude
,
prefix
,
dryrun
,
forceAllowSymlinks
):
def
loadpath
(
path
,
include
,
exclude
,
prefix
,
dryrun
,
forceAllowSymlinks
):
if
dryrun
:
if
dryrun
:
print
(
"
DRYRUN
"
)
logger
.
info
(
"
Performin a dryrun!
"
)
files
=
db
.
Container
().
retrieve
(
files
=
db
.
Container
().
retrieve
(
unique
=
False
,
unique
=
False
,
raise_exception_on_error
=
True
,
raise_exception_on_error
=
True
,
...
@@ -73,8 +75,8 @@ def loadpath(path, include, exclude, prefix, dryrun, forceAllowSymlinks):
...
@@ -73,8 +75,8 @@ def loadpath(path, include, exclude, prefix, dryrun, forceAllowSymlinks):
for
f
in
files
:
for
f
in
files
:
totalsize
+=
f
.
size
totalsize
+=
f
.
size
print
(
"
\n\n
TOTAL
"
+
str
(
len
(
files
))
+
logger
.
info
(
"
Made in total {} new files with a combined size of {}
"
"
NEW files (
"
+
convert_size
(
totalsize
)
+
"
)
"
)
"
accessible.
"
.
format
(
len
(
files
),
convert_size
(
totalsize
)
)
)
return
return
...
...
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