Skip to content

Commit

Permalink
Revert "setup a config for tutorials to test the mscolab refactoring (#…
Browse files Browse the repository at this point in the history
…2528)"

This reverts commit 22aa853.

e
  • Loading branch information
Preetam-Das26 committed Sep 30, 2024
1 parent 74d140d commit a4d2e1a
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 134 deletions.
3 changes: 0 additions & 3 deletions mslib/mscolab/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ class default_mscolab_settings:
# To enable Engine.IO logging set to True or pass a logger object to use.
ENGINEIO_LOGGER = False

# To enable flask socketio debugging, this sets in flask_socketio app.debug too
DEBUG = False

# Which origins are allowed to communicate with your server
CORS_ORIGINS = ["*"]

Expand Down
5 changes: 2 additions & 3 deletions mslib/mscolab/mscolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@
from mslib.utils import setup_logging


def handle_start(args=None):
def handle_start(args):
from mslib.mscolab.server import APP, sockio, cm, fm, start_server
if args is not None:
setup_logging(args)
setup_logging(args)
logging.info("MSS Version: %s", __version__)
logging.info("Python Version: %s", sys.version)
logging.info("Platform: %s (%s)", platform.platform(), platform.architecture())
Expand Down
2 changes: 1 addition & 1 deletion mslib/mscolab/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ def metadata(idp_identity_name):

def start_server(app, sockio, cm, fm, port=8083):
create_files()
sockio.run(app, port=port, debug=mscolab_settings.DEBUG)
sockio.run(app, port=port)


def main():
Expand Down
2 changes: 1 addition & 1 deletion tutorials/tutorial_mscolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,4 +553,4 @@ def _connect_to_mscolab_url():


if __name__ == '__main__':
start(target=automate_mscolab, duration=640, mscolab=True, dry_run=False)
start(target=automate_mscolab, duration=640)
6 changes: 6 additions & 0 deletions tutorials/tutorials.batch
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ cd ..
####################################################
# tutorial mscolab, 3K, because we need the menu in full screen

# start a mscolab server on standard port after you have it seeded
# we should have a seed for tutorials
$HOME/Miniforge/envs/mssdev/bin/python ../mslib/mscolab/mscolab.py db --seed

$HOME/Miniforge/envs/mssdev/bin/python ../mslib/mscolab/mscolab.py start &

~/bin/highlight-pointer -r 10 --key-quit q &
$HOME/Miniforge/envs/mssdev/bin/python tutorial_mscolab.py

Expand Down
50 changes: 5 additions & 45 deletions tutorials/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,6 @@ def call_msui():
msui.main(tutorial_mode=True)


def call_mscolab():
# change of config won't work when it becomes earlier imported
from mslib.mscolab import mscolab
with mscolab.APP.app_context():
# initialize our seeded example dbase
mscolab.handle_db_seed()
mscolab.handle_start()


def finish(close_widgets=3):
"""
Closes all open windows and exits the application.
Expand Down Expand Up @@ -138,7 +129,7 @@ def finish(close_widgets=3):
raise


def start(target=None, duration=120, dry_run=False, mscolab=False):
def start(target=None, duration=120, dry_run=False):
"""
Starts the automation process.
Expand All @@ -150,42 +141,15 @@ def start(target=None, duration=120, dry_run=False, mscolab=False):
Note: Uncomment the line pag.press('q') if recording windows do not close in some cases.
"""
if platform.system() == 'Linux':
tutdir = "/tmp/msui_tutorials"
if not os.path.isdir(tutdir):
os.mkdir(tutdir)
os.environ["MSUI_CONFIG_PATH"] = tutdir
os.environ["XDG_CACHE_HOME"] = tutdir
# makes sure the keyboard is set to US
os.system("setxkbmap -layout us")

# early
if mscolab:
mscdir = "/tmp/mscolab_tutorials"
if not os.path.isdir(mscdir):
os.makedirs(mscdir)
settings_file = os.path.join(mscdir, "mscolab_settings.py")
with open(settings_file, "w") as sf:
sf.write('import os\n')
sf.write('\n\n')
sf.write(f"BASE_DIR = '{mscdir}'\n")
sf.write('DATA_DIR = os.path.join(BASE_DIR, "colabdata")\n')
sf.write('OPERATIONS_DATA = os.path.join(DATA_DIR, "filedata")\n')
sf.write("DEBUG = True\n")

os.environ["MSCOLAB_SETTINGS"] = settings_file
sys.path.insert(0, mscdir)

if target is None:
return
p1 = multiprocessing.Process(target=call_msui)
p2 = multiprocessing.Process(target=target)
if not dry_run:
p3 = multiprocessing.Process(target=call_recorder, kwargs={"duration": duration})
p3.start()
if mscolab is True:
print("Start and Seed MSColab server")
p4 = multiprocessing.Process(target=call_mscolab, daemon=True)
p4.start()

print("\nINFO : Starting Automation.....\n")

Expand All @@ -194,15 +158,11 @@ def start(target=None, duration=120, dry_run=False, mscolab=False):
p1.start()
p2.start()

# unclear for what the join was needed
# p2.join()
# p1.join()
# if not dry_run:
# p3.join()
# if mscolab:
# p4.join()
p2.join()
p1.join()
if not dry_run:
p3.join()
print("\n\nINFO : Automation Completes Successfully!")

# pag.press('q') # In some cases, recording windows does not closes. So it needs to ne there.
sys.exit()

Expand Down
81 changes: 0 additions & 81 deletions tutorials/utils/restart_mscolab.py

This file was deleted.

0 comments on commit a4d2e1a

Please sign in to comment.