Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-api-local
Commits
c66fb6d8
Commit
c66fb6d8
authored
Apr 01, 2021
by
Wei Shoulin
Browse files
path bug
parent
0fe65969
Changes
5
Hide whitespace changes
Inline
Side-by-side
csst_dfs_api_local/ifs/__init__.py
View file @
c66fb6d8
...
@@ -27,11 +27,14 @@ def ingest():
...
@@ -27,11 +27,14 @@ def ingest():
elif
'sky'
in
filename
.
lower
():
elif
'sky'
in
filename
.
lower
():
file_type
=
'sky'
file_type
=
'sky'
file_path
=
file_full_path
.
replace
(
root_dir
,
''
)
if
file_path
.
index
(
"/"
)
==
0
:
file_path
=
file_path
[
1
:]
if
file_type
in
[
'obs'
]:
if
file_type
in
[
'obs'
]:
fitsApi
.
import2db
(
file_path
=
file_
full_path
.
replace
(
root_dir
,
''
)[
1
:]
)
fitsApi
.
import2db
(
file_path
=
file_
path
)
print
(
"%s [type:%s] imported"
%
(
file_full_path
,
file_type
))
print
(
"%s [type:%s] imported"
%
(
file_full_path
,
file_type
))
if
file_type
in
[
'flat'
,
'bias'
,
'arc'
,
'hgar'
,
'sky'
]:
if
file_type
in
[
'flat'
,
'bias'
,
'arc'
,
'hgar'
,
'sky'
]:
refApi
.
import2db
(
file_path
=
file_
full_path
.
replace
(
root_dir
,
''
)[
1
:]
)
refApi
.
import2db
(
file_path
=
file_
path
)
print
(
"%s [type:%s] imported"
%
(
file_full_path
,
file_type
))
print
(
"%s [type:%s] imported"
%
(
file_full_path
,
file_type
))
return
paths
return
paths
csst_dfs_api_local/ifs/fits.py
View file @
c66fb6d8
...
@@ -27,10 +27,6 @@ class FitsApi(object):
...
@@ -27,10 +27,6 @@ class FitsApi(object):
log
.
info
(
"using [%s] as root directory"
,
self
.
root_dir
)
log
.
info
(
"using [%s] as root directory"
,
self
.
root_dir
)
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
root_dir
,
"fits"
)):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
root_dir
,
"fits"
)):
os
.
mkdir
(
os
.
path
.
join
(
self
.
root_dir
,
"fits"
))
os
.
mkdir
(
os
.
path
.
join
(
self
.
root_dir
,
"fits"
))
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
root_dir
,
"refs"
)):
os
.
mkdir
(
os
.
path
.
join
(
self
.
root_dir
,
"refs"
))
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
root_dir
,
"results"
)):
os
.
mkdir
(
os
.
path
.
join
(
self
.
root_dir
,
"results"
))
def
find
(
self
,
**
kwargs
):
def
find
(
self
,
**
kwargs
):
'''
'''
...
@@ -216,4 +212,8 @@ class FitsApi(object):
...
@@ -216,4 +212,8 @@ class FitsApi(object):
new_file_path
=
os
.
path
.
join
(
new_file_dir
,
file_basename
)
new_file_path
=
os
.
path
.
join
(
new_file_dir
,
file_basename
)
shutil
.
copyfile
(
file_path
,
new_file_path
)
shutil
.
copyfile
(
file_path
,
new_file_path
)
self
.
import2db
(
file_path
=
new_file_path
.
replace
(
self
.
root_dir
,
''
)[
1
:])
file_path
=
new_file_path
.
replace
(
self
.
root_dir
,
''
)
\ No newline at end of file
if
file_path
.
index
(
"/"
)
==
0
:
file_path
=
file_path
[
1
:]
self
.
import2db
(
file_path
=
file_path
)
\ No newline at end of file
csst_dfs_api_local/ifs/reffits.py
View file @
c66fb6d8
...
@@ -208,7 +208,11 @@ class RefFitsApi(object):
...
@@ -208,7 +208,11 @@ class RefFitsApi(object):
new_file_path
=
os
.
path
.
join
(
new_file_dir
,
file_basename
)
new_file_path
=
os
.
path
.
join
(
new_file_dir
,
file_basename
)
shutil
.
copyfile
(
file_path
,
new_file_path
)
shutil
.
copyfile
(
file_path
,
new_file_path
)
self
.
import2db
(
file_path
=
new_file_path
.
replace
(
self
.
root_dir
,
''
)[
1
:])
file_path
=
new_file_path
.
replace
(
self
.
root_dir
,
''
)
if
file_path
.
index
(
"/"
)
==
0
:
file_path
=
file_path
[
1
:]
self
.
import2db
(
file_path
=
file_path
)
def
associate_raw
(
self
,
**
kwargs
):
def
associate_raw
(
self
,
**
kwargs
):
...
...
csst_dfs_api_local/ifs/result0.py
View file @
c66fb6d8
...
@@ -114,10 +114,14 @@ class Result0Api(object):
...
@@ -114,10 +114,14 @@ class Result0Api(object):
new_file_path
=
os
.
path
.
join
(
new_file_dir
,
file_basename
)
new_file_path
=
os
.
path
.
join
(
new_file_dir
,
file_basename
)
shutil
.
copyfile
(
file_path
,
new_file_path
)
shutil
.
copyfile
(
file_path
,
new_file_path
)
file_path
=
new_file_path
.
replace
(
self
.
root_dir
,
''
)
if
file_path
.
index
(
"/"
)
==
0
:
file_path
=
file_path
[
1
:]
self
.
db
.
execute
(
self
.
db
.
execute
(
'INSERT INTO ifs_result_0 (filename, file_path, raw_id, proc_type, create_time)
\
'INSERT INTO ifs_result_0 (filename, file_path, raw_id, proc_type, create_time)
\
VALUES(?,?,?,?,?)'
,
VALUES(?,?,?,?,?)'
,
(
file_basename
,
new_
file_path
.
replace
(
self
.
root_dir
,
''
)[
1
:]
,
raw_id
,
proc_type
,
format_time_ms
(
time
.
time
()))
(
file_basename
,
file_path
,
raw_id
,
proc_type
,
format_time_ms
(
time
.
time
()))
)
)
self
.
db
.
end
()
self
.
db
.
end
()
...
...
csst_dfs_api_local/ifs/result1.py
View file @
c66fb6d8
...
@@ -110,10 +110,14 @@ class Result1Api(object):
...
@@ -110,10 +110,14 @@ class Result1Api(object):
shutil
.
copyfile
(
file_path
,
new_file_path
)
shutil
.
copyfile
(
file_path
,
new_file_path
)
file_path
=
new_file_path
.
replace
(
self
.
root_dir
,
''
)
if
file_path
.
index
(
"/"
)
==
0
:
file_path
=
file_path
[
1
:]
self
.
db
.
execute
(
self
.
db
.
execute
(
'INSERT INTO ifs_result_1 (filename, file_path, proc_type, create_time)
\
'INSERT INTO ifs_result_1 (filename, file_path, proc_type, create_time)
\
VALUES(?,?,?,?)'
,
VALUES(?,?,?,?)'
,
(
file_basename
,
new_
file_path
.
replace
(
self
.
root_dir
,
''
)[
1
:]
,
proc_type
,
format_time_ms
(
time
.
time
()),)
(
file_basename
,
file_path
,
proc_type
,
format_time_ms
(
time
.
time
()),)
)
)
self
.
db
.
end
()
self
.
db
.
end
()
result1_id
=
1
result1_id
=
1
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment