Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions wellies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def wrapper(*args, **kwargs):
from .data import StaticDataStore
from .deployment import deploy_suite
from .hosts import EcflowServer
from .hosts import DeployHost
from .hosts import get_host
from .log_archiving import ArchivedRepeatFamily
from .tasks import EcfResourcesTask
Expand Down
2 changes: 2 additions & 0 deletions wellies/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,5 @@ def deploy_suite(
logger.info(f"Definition file: {target_repo}/{name}.def")
else:
logger.info("No deploy option activated. Deployment aborted")

return f"{target_repo}/{name}.def"
8 changes: 8 additions & 0 deletions wellies/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ class EcflowServer:
hostname: str
user: str
deploy_dir: str
port: str = "3141"
group: str = None # Optional suites group for the ecflow server


@dataclass
class DeployHost:
hostname: str
user: str
port: str = "22"


def get_host(
hostname: str,
user: str,
Expand Down
62 changes: 61 additions & 1 deletion wellies/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"user": "{USER}",
"author": pw_user.pw_gecos,
"output_root": "{HOME}/output",
"deploy_root": "{HOME}/pyflow",
"deploy_root": "{HOME}/pyflow"
}


Expand Down Expand Up @@ -102,6 +102,29 @@ def write_file(fpath: str, content: str) -> None:
path.join(root_path, "profiles.yaml"),
renderer.render("profiles.yaml_t", options),
)
write_file(
path.join(root_path, "pyproject.toml"),
renderer.render("pyproject.toml_t", options),
)
write_file(
path.join(root_path, ".gitignore"),
renderer.render(".gitignore_t", options),
)

#create launch.json for VSCode
vscode_dir = path.join(root_path, ".vscode")
os.makedirs(vscode_dir, exist_ok=True)
options['lib_dir'] = options.get('lib_dir', f"{out_root.replace('{name}', project).replace('{HOME}', os.environ['HOME']).replace('{PERM}', os.environ['PERM']).replace('{HPCPERM}', os.environ['HPCPERM'])}/local")
options['src_dir'] = options.get('src_dir', f"{out_root.replace('{name}', project).replace('{HOME}', '${env:HOME}').replace('{PERM}', '${env:PERM}').replace('{HPCPERM}', '${env:HPCPERM}')}/src")
options['suite_env'] = options.get('suite_env', 'suite_env')
write_file(
path.join(vscode_dir, "launch.json"),
renderer.render("launch.json_t", options),
)
write_file(
path.join(vscode_dir, "tasks.json"),
renderer.render("tasks.json_t", options),
)

# create suite folder containing config.py and nodes.py
suite_dir = path.join(root_path, project)
Expand All @@ -116,6 +139,38 @@ def write_file(fpath: str, content: str) -> None:
)
write_file(path.join(suite_dir, "__init__.py"), "") # empty __init__.py

# create snippets folder containing ecf stubs
snippets_dir = path.join(root_path, "snippets")
os.makedirs(snippets_dir, exist_ok=True)
write_file(
path.join(snippets_dir, "dummy"),
renderer.render("dummy_t", options),
)
write_file(
path.join(snippets_dir, "clean_init"),
renderer.render("clean_init_t", options),
)
write_file(
path.join(snippets_dir, "self_destruct"),
renderer.render("self_destruct_t", options),
)

# create src folder containing source files called in ecf scritps
src_dir = path.join(root_path, "src")
os.makedirs(src_dir, exist_ok=True)
write_file(
path.join(src_dir, "dummy.py"),
renderer.render("dummy.py_t", options),
)

# create manuals folder containing the suite manual
manuals_dir = path.join(root_path, "manuals")
os.makedirs(manuals_dir, exist_ok=True)
write_file(
path.join(manuals_dir, "generic.man_t"),
renderer.render("generic.man_t_t", options),
)

# create config folder containing yaml files
config_dir = path.join(root_path, "configs")
os.makedirs(config_dir, exist_ok=True)
Expand All @@ -135,6 +190,10 @@ def write_file(fpath: str, content: str) -> None:
path.join(config_dir, "data.yaml"),
renderer.render("data.yaml_t", options),
)
write_file(
path.join(config_dir, "src.yaml"),
renderer.render("src.yaml_t", options),
)

# write test file
test_dir = path.join(root_path, "tests")
Expand Down Expand Up @@ -271,6 +330,7 @@ def main(argv: List[str] = sys.argv[1:]) -> int:
r"\W", "_", options["project"]
) # can't have special characters in python module names
options["profiles"] = '"profiles.yaml"' # default profiles file

try:
if "interactive" in options:
ask_user(options)
Expand Down
210 changes: 210 additions & 0 deletions wellies/templates/.gitignore_t
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py.cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
#poetry.toml

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
#pdm.lock
#pdm.toml
.pdm-python
.pdm-build/

# pixi
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
#pixi.lock
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
# in the .venv directory. It is recommended not to include this directory in version control.
.pixi

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.envrc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Abstra
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/

# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc

# Cursor
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
# refer to https://docs.cursor.com/context/ignore-files
.cursorignore
.cursorindexingignore

# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/

# generated man pages
*.man
Loading
Loading