Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Workflow_Commands
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Show more breadcrumbs
dnarXiv
Workflow_Commands
Commits
c6356bb7
Commit
c6356bb7
authored
3 years ago
by
BOULLE Olivier
Browse files
Options
Downloads
Patches
Plain Diff
updated new documents index management
parent
1b2d93ff
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dna_add.sh
+3
-15
3 additions, 15 deletions
dna_add.sh
metadata_manager.sh
+17
-5
17 additions, 5 deletions
metadata_manager.sh
with
20 additions
and
20 deletions
dna_add.sh
+
3
−
15
View file @
c6356bb7
...
...
@@ -96,30 +96,18 @@ then
exit
1
fi
#get list of current documents in the container
doc_list
=
$(
find
"
$container_path
"
/
*
-maxdepth
0
-type
d
-printf
"%f
\n
"
)
#if none, new document of index 0
if
[
-z
"
$doc_list
"
]
;
then
doc_index
=
0
else
#else index equals to max index +1
max_index
=
$(
echo
"
${
doc_list
[*]
}
"
|
sort
-nr
|
head
-n1
)
doc_index
=
$((
max_index+1
))
fi
# add a new document in the xml file and get its new index
doc_index
=
$(
add_document
"
$container_path
"
)
stored_document_path
=
"
$container_path
"
/
$doc_index
mkdir
-p
"
$stored_document_path
"
add_document
"
$container_path
"
$doc_index
#----Source Encoding----#
# get the fragment length from the container options
frag_length
=
$(
get_container_param
$container_path
"frag_length"
)
#----Source Encoding----#
assembly_type
=
$(
get_container_param
$container_path
"assembly_type"
)
source_encoding_script
=
"
$project_dir
"
/source_encoding/source_encoding.py
...
...
This diff is collapsed.
Click to expand it.
metadata_manager.sh
+
17
−
5
View file @
c6356bb7
...
...
@@ -71,21 +71,34 @@ set_container_param() {
add_document
()
{
#add a new document to the container
#$1 container path
#$2 document index
#save operation in logs
log_metadata_call
"
$1
"
add_document
"
$2
"
log_metadata_call
"
$1
"
add_document
#define the new document index
index_list
=
$(
xmlstarlet sel
-t
-v
"/container_metadata/documents/document/@id"
"
$1
"
/
$meta_file_name
)
#if existing index list is none, new document has index 0
if
[
-z
"
$index_list
"
]
;
then
doc_index
=
"0"
else
#max existing index +1
doc_index
=
$((
$(
echo
"
${
index_list
[*]
}
"
|
sort
-nr
|
head
-n1
)
+
1
))
fi
#add a document then add the attribute 'index' for all documents wo attribute (should only be the added one)
xmlstarlet edit
-L
-s
"/container_metadata/documents"
--type
elem
--name
document
\
--insert
"/container_metadata/documents/document[not(@id)]"
--type
attr
--name
id
--value
"
$2
"
\
--insert
"/container_metadata/documents/document[not(@id)]"
--type
attr
--name
id
--value
$doc_index
\
"
$1
"
/
$meta_file_name
#add the creation date
add_doc_param
$1
$
2
"creation_date"
"
$(
date
)
"
add_doc_param
$1
$
doc_index
"creation_date"
"
$(
date
)
"
#----Update number of documents----#
number_doc
=
$(
get_container_param
"
$1
"
"number_of_documents"
)
set_container_param
"
$1
"
"number_of_documents"
$((
number_doc+1
))
#return the index of the new document
echo
$doc_index
}
...
...
@@ -150,4 +163,3 @@ get_all_doc_param() {
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