Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.db.cohface
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.db.cohface
Commits
56d291da
There was a problem fetching the pipeline summary.
Commit
56d291da
authored
8 years ago
by
André Anjos
Browse files
Options
Downloads
Plain Diff
Merge branch 'issue_2' into 'master'
Clean-up database download (closes
#2
) See merge request
!6
parents
2eb3f2f4
babf6a0e
No related branches found
No related tags found
1 merge request
!6
Clean-up database download (closes #2)
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+2
-2
2 additions, 2 deletions
.gitlab-ci.yml
bob/db/cohface/driver.py
+4
-94
4 additions, 94 deletions
bob/db/cohface/driver.py
with
6 additions
and
96 deletions
.gitlab-ci.yml
+
2
−
2
View file @
56d291da
...
...
@@ -28,7 +28,7 @@ stages:
-
./_ci/install.sh _ci
#updates
-
./_ci/before_build.sh
script
:
-
./_ci/build.sh
cohface
-
./_ci/build.sh
after_script
:
-
./_ci/after_build.sh
artifacts
:
...
...
@@ -98,7 +98,7 @@ stages:
-
branches
before_script
:
-
./_ci/install.sh _ci
#updates
-
./_ci/before_deploy.sh
cohface
-
./_ci/before_deploy.sh
script
:
-
./_ci/deploy.sh
after_script
:
...
...
This diff is collapsed.
Click to expand it.
bob/db/cohface/driver.py
+
4
−
94
View file @
56d291da
...
...
@@ -240,80 +240,6 @@ def write_kpts_and_hr(args):
return
0
def
_files
():
filelist
=
pkg_resources
.
resource_filename
(
__name__
,
'
files.txt
'
)
return
[
k
.
strip
()
for
k
in
open
(
filelist
,
'
rt
'
).
readlines
()
if
k
.
strip
()]
def
upload
(
arguments
):
"""
Uploads generated metadata to the Idiap build server
"""
target_file
=
os
.
path
.
join
(
arguments
.
destination
,
arguments
.
name
+
"
.tar.bz2
"
)
# check all files exist
names
=
_files
()
paths
=
[
pkg_resources
.
resource_filename
(
__name__
,
f
)
for
f
in
names
]
for
n
,
p
in
zip
(
names
,
paths
):
if
not
os
.
path
.
exists
(
p
):
raise
IOError
(
"
Metadata file `%s
'
(path: %s) is not available. Did you run `mkmeta
'
before attempting to upload?
"
%
(
n
,
p
))
# if you get here, all files are there, ready to package
print
(
"
Compressing metadata files to `%s
'"
%
(
target_file
,))
# compress
import
tarfile
f
=
tarfile
.
open
(
target_file
,
'
w:bz2
'
)
for
k
,(
n
,
p
)
in
enumerate
(
zip
(
names
,
paths
)):
print
(
"
+ [%d/%d] %s
"
%
(
k
+
1
,
len
(
names
),
n
))
f
.
add
(
p
,
n
)
f
.
close
()
# set permissions for sane Idiap storage
import
stat
perms
=
stat
.
S_IRUSR
|
stat
.
S_IWUSR
|
stat
.
S_IRGRP
|
stat
.
S_IWGRP
|
stat
.
S_IROTH
os
.
chmod
(
target_file
,
perms
)
def
download
(
arguments
):
"""
Downloads and uncompresses meta data generated files from Idiap
"""
# check all files don't exist
names
=
_files
()
paths
=
[
pkg_resources
.
resource_filename
(
__name__
,
f
)
for
f
in
names
]
for
n
,
p
in
zip
(
names
,
paths
):
if
os
.
path
.
exists
(
p
):
if
arguments
.
force
:
os
.
unlink
(
p
)
else
:
raise
IOError
(
"
Metadata file `%s
'
(path: %s) is already available. Please remove self-generated files before attempting download or --force
"
%
(
n
,
p
))
# if you get here, all files aren't there, unpack
source_url
=
os
.
path
.
join
(
arguments
.
source
,
arguments
.
name
+
"
.tar.bz2
"
)
# download file from Idiap server, unpack and remove it
import
sys
,
tempfile
,
tarfile
if
sys
.
version_info
[
0
]
<=
2
:
import
urllib2
as
urllib
else
:
import
urllib.request
as
urllib
try
:
print
(
"
Extracting url `%s
'"
%
(
source_url
,))
u
=
urllib
.
urlopen
(
source_url
)
f
=
tempfile
.
NamedTemporaryFile
(
suffix
=
"
.tar.bz2
"
)
open
(
f
.
name
,
'
wb
'
).
write
(
u
.
read
())
t
=
tarfile
.
open
(
fileobj
=
f
,
mode
=
'
r:bz2
'
)
t
.
extractall
(
pkg_resources
.
resource_filename
(
__name__
,
''
))
t
.
close
()
f
.
close
()
return
False
except
Exception
as
e
:
print
(
"
Error while downloading: %s
"
%
e
)
return
True
class
Interface
(
BaseInterface
):
...
...
@@ -322,7 +248,10 @@ class Interface(BaseInterface):
def
files
(
self
):
return
_files
()
basedir
=
pkg_resources
.
resource_filename
(
__name__
,
''
)
filelist
=
os
.
path
.
join
(
basedir
,
'
files.txt
'
)
return
[
os
.
path
.
join
(
basedir
,
k
.
strip
())
for
k
in
\
open
(
filelist
,
'
rt
'
).
readlines
()
if
k
.
strip
()]
def
version
(
self
):
...
...
@@ -383,22 +312,3 @@ class Interface(BaseInterface):
meta_message
=
write_kpts_and_hr
.
__doc__
meta_parser
=
subparsers
.
add_parser
(
'
write-kpts-hr
'
,
help
=
write_kpts_and_hr
.
__doc__
)
meta_parser
.
set_defaults
(
func
=
write_kpts_and_hr
)
#action
# add upload command
upload_meta
=
upload
.
__doc__
upload_parser
=
subparsers
.
add_parser
(
'
upload
'
,
help
=
upload
.
__doc__
)
upload_parser
.
add_argument
(
"
--destination
"
,
default
=
"
/idiap/group/torch5spro/databases/latest
"
)
upload_parser
.
set_defaults
(
func
=
upload
)
# add download command
if
'
DOCSERVER
'
in
os
.
environ
:
USE_SERVER
=
os
.
environ
[
'
DOCSERVER
'
]
else
:
USE_SERVER
=
'
https://www.idiap.ch
'
download_meta
=
download
.
__doc__
download_parser
=
subparsers
.
add_parser
(
'
download
'
,
help
=
download
.
__doc__
)
download_parser
.
add_argument
(
"
--source
"
,
default
=
"
%s/software/bob/databases/latest/
"
%
USE_SERVER
)
download_parser
.
add_argument
(
"
--force
"
,
action
=
'
store_true
'
,
help
=
"
Overwrite existing metadata files?
"
)
download_parser
.
set_defaults
(
func
=
download
)
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