Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CADET-RDM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IBG-1
ModSim
CADET
CADET-RDM
Commits
f9a26ae9
Commit
f9a26ae9
authored
1 year ago
by
Ronald Jäpel
Browse files
Options
Downloads
Patches
Plain Diff
add ability to run python files and arbitrary commands from the CLI
parent
1e9d4ac0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cadetrdm/cli_integration.py
+23
-0
23 additions, 0 deletions
cadetrdm/cli_integration.py
with
23 additions
and
0 deletions
cadetrdm/cli_integration.py
+
23
−
0
View file @
f9a26ae9
import
shlex
import
subprocess
import
click
from
.repositories
import
ProjectRepo
...
...
@@ -47,6 +50,26 @@ def fill_data_from_cadet_rdm_json(re_load=False):
repo
.
fill_data_from_cadet_rdm_json
(
re_load
=
re_load
)
@cli.command
()
@click.argument
(
'
file_name
'
)
@click.argument
(
'
results_commit_message
'
)
def
run_python_file
(
file_name
,
results_commit_message
):
repo
=
ProjectRepo
(
"
.
"
)
repo
.
enter_context
()
subprocess
.
run
([
"
python
"
,
file_name
])
repo
.
exit_context
(
results_commit_message
)
@cli.command
()
@click.argument
(
'
command
'
)
@click.argument
(
'
results_commit_message
'
)
def
run_command
(
command
,
results_commit_message
):
repo
=
ProjectRepo
(
"
.
"
)
repo
.
enter_context
()
subprocess
.
run
(
shlex
.
split
(
command
))
repo
.
exit_context
(
results_commit_message
)
@cli.command
()
@click.option
(
'
--output_repo_name
'
,
default
=
"
output
"
,
help
=
'
Name of the folder where the tracked output should be stored. Optional. Default:
"
output
"
.
'
)
...
...
This diff is collapsed.
Click to expand it.
Ronald Jäpel
@r.jaepel
mentioned in issue
#15 (closed)
·
1 year ago
mentioned in issue
#15 (closed)
mentioned in issue #15
Toggle commit list
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