This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Module to test remote execution using Celery queue with Redis backend. | |
Setup: | |
* a redis database must be running and accessible. | |
* the environment variable redis_host mut be defined with value <ip>:<port> | |
* celery and redis packages must be installed | |
* celery worker(s) must be running this script: | |
```celery worker -A tests.test_remote -l info --autoscale=5,1``` | |
Execute test: | |
pytest tests/test_remote.py | |
License: GPL v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Save the file where you can import it in your jupyter notebook. | |
In a cell, execute: | |
import plantumlmagic | |
%reload_ext plantumlmagic | |
Then you can use the magic in another cell: | |
%%plantumlmagic localhost:1234 | |
@startuml | |
Bob -> Alice : hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Function to convert a tree in string format to a dictionary. | |
There is no error handling. | |
It doesn't allow a level to be skipped. | |
""" | |
def tree_child(acc, path, element): | |
node = element.lstrip() | |
current = None | |
for p in path: | |
if current: | |
current = current[p] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import traceback | |
import sys | |
import logging | |
logger = logging.getLogger(__name__) | |
def explore_path(path, params): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prop_match = re.compile(r'\s*(?P<prop_id>\S+)\s*=\s*(?P<prop_val>\S+)') # pylint: disable=W1401 | |
def extract_properties(filename): | |
""" Extract properties from file | |
Args: | |
filename(str): file path | |
Returns: |