Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IMP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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 GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IMP-dev
IMP
Commits
4f770a63
Commit
4f770a63
authored
9 years ago
by
Yohan Jarosz
Browse files
Options
Downloads
Patches
Plain Diff
fix user issue
parent
1c28f624
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
IMP
+17
-8
17 additions, 8 deletions
IMP
with
17 additions
and
8 deletions
IMP
+
17
−
8
View file @
4f770a63
...
...
@@ -3,6 +3,7 @@ from lib.docopt import docopt
from
lib.path
import
Path
import
subprocess
import
os
import
getpass
import
json
import
shlex
from
copy
import
deepcopy
...
...
@@ -68,6 +69,12 @@ def yes_or_no(question):
return
yes_or_no
(
"
Please enter
"
)
def
format_command
(
cmd
,
dir
):
# get group id and username of the user
username
=
getpass
.
getuser
()
return
'
/bin/bash -c
"
{c} ; useradd {u} && chown -R {u} {d} && chmod 755 {d}
"'
.
format
(
c
=
cmd
,
u
=
username
,
d
=
dir
)
def
init
(
args
):
CURRENT_PATH
=
Path
(
__file__
).
parent
.
abspath
()
# start docker container to index files and setup prokka
...
...
@@ -76,10 +83,11 @@ def init(args):
cmd
=
[
'
docker
'
,
'
run
'
,
'
--rm
'
,
'
-v %s:/code
'
%
CURRENT_PATH
,
'
-v %s:/databases
'
%
db_path
,
container_name
,
'
snakemake -s /code/init.rule
'
'
-v %s:/databases
'
%
db_path
,
container_name
]
print
(
"
Executing
"
,
'"'
,
'
'
.
join
(
cmd
),
'"'
)
subprocess
.
call
(
shlex
.
split
(
'
'
.
join
(
cmd
)))
cmd
=
'
'
.
join
(
cmd
)
+
format_command
(
'
snakemake -s /code/init.rule
'
,
'
/databases
'
)
print
(
"
Executing
"
,
'"'
,
cmd
,
'"'
)
subprocess
.
call
(
cmd
,
shell
=
True
)
def
run
(
args
):
...
...
@@ -136,14 +144,15 @@ def run(args):
if
args
[
'
--enter
'
]:
cmd
+=
[
'
-it
'
]
# add container name and commands to pass to snakemake
cmd
+=
[
container_name
]
+
args
[
'
COMMANDS
'
]
cmd
+=
[
container_name
]
# if --enter flag is specified, change the command
if
args
[
'
--enter
'
]:
cmd
+=
[
'
/bin/bash
'
]
# parse CL correctly
cmd
=
shlex
.
split
(
'
'
.
join
(
cmd
))
print
(
"
Executing
"
,
'"'
,
'
'
.
join
(
cmd
),
'"'
)
subprocess
.
call
(
cmd
)
cmd
=
'
'
.
join
(
cmd
)
+
format_command
(
'
'
.
join
(
args
[
'
COMMANDS
'
]),
'
/output
'
)
print
(
"
Executing
"
,
'"'
,
cmd
,
'"'
)
subprocess
.
call
(
cmd
,
shell
=
True
)
def
validate
(
args
):
...
...
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