Commit 4bd73009 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Polish the run script.

parent 6df8af54
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
When the same software serves several applications, it is possible When the same software serves several applications, it is possible
to select one of the application: to select one of the application:
> cd ... track_publications/scripts
> ./run -S my_application_2 script my_script.py > ./run -S my_application_2 script my_script.py
The `loop` subcommand allows to execute the same script on all The `loop` subcommand allows to execute the same script on all
...@@ -33,22 +32,25 @@ ...@@ -33,22 +32,25 @@
For each application a confirmation is required before executing the For each application a confirmation is required before executing the
python script: python script:
> cd ... track_publications/scripts
> ./run loop ../models/_db_pro.py my_script.py > ./run loop ../models/_db_pro.py my_script.py
The 'mysql' subcommand allows to execute a sql script on all databases. The 'mysql' subcommand allows to execute a sql script on all databases.
It used the DBURIS dictionary to connect to them. For each application It used the DBURIS dictionary to connect to them. For each application
a confirmation is required before excetuting the sql script. a confirmation is required before excetuting the sql script. The
database of one application can also be selected with the --shell
option.
> cd ... track_publications/scripts
> ./run mysql ../models/_db_pro.py my_script.sql > ./run mysql ../models/_db_pro.py my_script.sql
> ./run -S my_app_2 mysql ../models/_db_pro.py my_script.sql
The 'dump' subcommand dumps the content of all databases. It used the The 'dump' subcommand dumps the content of all databases. It used the
DBURIS dictionary to connect to them and the command mysqldump. For DBURIS dictionary to connect to them and the command mysqldump. For
each application a confirmation is required before the dump. each application a confirmation is required before the dump. The
database of one application can also be dumped with the --shell
option.
> cd ... track_publications/scripts
> ./run dump ../models/_db_pro.py > ./run dump ../models/_db_pro.py
> ./run -S my_app_2 dump ../models/_db_pro.py
The 'pytest' subcommand runs python tests within the pytest framework The 'pytest' subcommand runs python tests within the pytest framework
and the application context. The python tests are located in the and the application context. The python tests are located in the
...@@ -216,6 +218,10 @@ def run_dump(args): ...@@ -216,6 +218,10 @@ def run_dump(args):
# loop over databases # loop over databases
for app, dburi in locals()['DBURIS'].iteritems(): for app, dburi in locals()['DBURIS'].iteritems():
if args.shell and args.shell != app:
continue
msg = MSG_DUMP % app msg = MSG_DUMP % app
rep = raw_input(msg) rep = raw_input(msg)
if rep != "y": if rep != "y":
...@@ -258,6 +264,10 @@ def run_mysql(args): ...@@ -258,6 +264,10 @@ def run_mysql(args):
# loop over databases # loop over databases
for app, dburi in locals()['DBURIS'].iteritems(): for app, dburi in locals()['DBURIS'].iteritems():
if args.shell and args.shell != app:
continue
msg = MSG_SCRIPT % (args.filename, app) msg = MSG_SCRIPT % (args.filename, app)
rep = raw_input(msg) rep = raw_input(msg)
if rep != "y": if rep != "y":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment