Skip to content

Move common docs upstream #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
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
71 changes: 71 additions & 0 deletions docs/source/alternative_install.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
:orphan:

.. _alternative_install:

.. jinja:: first_ctx

#################################
Alternative installation methods
#################################

******************
{{ app_name }} CLI
******************

The {{ app_name }} CLI can be installed on Linux, macOS, and Windows through a terminal
or shell prompt:

.. tab-set::

.. tab-item:: Linux/macOS

Open a terminal, paste the command shown below and press enter.

.. code-block:: bash

(touch tmp.sh && curl -fsSL https://raw.githubusercontent.com/hpcflow/install-scripts/main/src/install-{{ app_package_name }}.sh > tmp.sh && bash tmp.sh --prerelease --path --univlink) ; rm tmp.sh

.. tab-item:: Windows

Open a Powershell terminal, paste the command shown below and press enter.

.. code-block:: powershell

& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/hpcflow/install-scripts/main/src/install-{{ app_package_name }}.ps1'))) -PreRelease -UnivLink

.. admonition:: What does this script do?
:class: note dropdown

The above command downloads a script from the {{ app_name }} GitHub repository and runs it. The script does the following:

#. It downloads the latest prerelease version of {{ app_name }} zip archived in a single folder.
#. The archive is extracted and the folder placed in an accessible location. The location depends on the operating system. In Linux it is ``/.local/share/{{ app_package_name }}``. In macOS it is ``~/Library/Application Support/{{ app_package_name }}``. In Windows it is ``Username\AppData\Local\{{ app_package_name }}``.
#. A symbolic link (Linux/macOS) or an alias pointing to the file is created. This allows {{ app_name }} to be run by entering a simple command.
#. A command is added to ``.bashrc``/``.zshrc`` (linux/macOS) or the Powershell profile (Windows) that allows {{ app_name }} to be run from any folder.

If the script detects that the version of {{ app_name }} it is trying to install is already there, it will stop
running and exit.



.. hint::

If you are installing {{ app_name }} on an HPC resource, check that you can connect
to the internet first. You might need to load a proxy module, for example.


********************************
Download CLI binaries (advanced)
********************************

Binaries are available in two formats, corresponding to the two different formats that
PyInstaller `can generate <https://pyinstaller.org/en/stable/usage.html#what-to-generate>`_:

* A single executable file containing everything.
* A folder containing an executable and supporting files.

Click below to download the {{ app_name }} binary for your platform:

.. raw:: html

{{ download_links_table_html }}
5 changes: 4 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ def prepare_task_schema_action_info(app: BaseApp):

# distribution name (i.e. name on PyPI):
with open("../../pyproject.toml") as fp:
dist_name = tomlkit.load(fp)["tool"]["poetry"]["name"]
pyproject_config = tomlkit.load(fp)
dist_name = pyproject_config["tool"]["poetry"]["name"]
supported_python = pyproject_config["tool"]["poetry"]["dependencies"]["python"]

extensions = [
"sphinx.ext.autodoc",
Expand Down Expand Up @@ -274,6 +276,7 @@ def prepare_task_schema_action_info(app: BaseApp):
"download_links_table_html": generate_download_links_table(),
"github_user": github_user,
"github_repo": github_repo,
"supported_python": supported_python,
}
}

Expand Down
171 changes: 100 additions & 71 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,86 +22,115 @@

The CLI and the Python package can be used simultaneously.

******************
{{ app_name }} CLI
******************

The {{ app_name }} CLI can be installed on Linux, macOS, and Windows through a terminal
or shell prompt:

.. tab-set::

.. tab-item:: Linux/macOS

Open a terminal, paste the command shown below and press enter.

.. code-block:: bash

(touch tmp.sh && curl -fsSL https://raw.githubusercontent.com/hpcflow/install-scripts/main/src/install-{{ app_package_name }}.sh > tmp.sh && bash tmp.sh --prerelease --path --univlink) ; rm tmp.sh

.. tab-item:: Windows

Open a Powershell terminal, paste the command shown below and press enter.

.. code-block:: powershell

& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/hpcflow/install-scripts/main/src/install-{{ app_package_name }}.ps1'))) -PreRelease -UnivLink

.. admonition:: What does this script do?
:class: note dropdown

The above command downloads a script from the {{ app_name }} GitHub repository and runs it. The script does the following:

#. It downloads the latest prerelease version of {{ app_name }} zip archived in a single folder.
#. The archive is extracted and the folder placed in an accessible location. The location depends on the operating system. In Linux it is ``/.local/share/{{ app_package_name }}``. In macOS it is ``~/Library/Application Support/{{ app_package_name }}``. In Windows it is ``Username\AppData\Local\{{ app_package_name }}``.
#. A symbolic link (Linux/macOS) or an alias pointing to the file is created. This allows {{ app_name }} to be run by entering a simple command.
#. A command is added to ``.bashrc``/``.zshrc`` (linux/macOS) or the Powershell profile (Windows) that allows {{ app_name }} to be run from any folder.

If the script detects that the version of {{ app_name }} it is trying to install is already there, it will stop
running and exit.



.. hint::

If you are installing {{ app_name }} on an HPC resource, check that you can connect
to the internet first. You might need to load a proxy module, for example.

*****************************
{{ app_name }} Python package
*****************************

Using pip
==========================

Use pip to install the Python package from PyPI::

pip install {{ dist_name }}=="{{ app_version }}"

Using conda
===========
The recommended way to install {{ app_name }} is to
use pip to install the Python package from PyPI::

Coming soon!
pip install {{ dist_name }}

********************************
Download CLI binaries (advanced)
********************************

Binaries are available in two formats, corresponding to the two different formats that
PyInstaller `can generate <https://pyinstaller.org/en/stable/usage.html#what-to-generate>`_:

* A single executable file containing everything.
* A folder containing an executable and supporting files.

Click below to download the {{ app_name }} binary for your platform:

.. raw:: html

{{ download_links_table_html }}
This installs the python package, which also gives the CLI version of {{ app_name }}.

*************
Release notes
*************

Release notes for this version ({{app_version}}) are `available on GitHub <https://github.com/{{ github_user }}/{{ github_repo }}/releases/tag/v{{ app_version }}>`_.
Use the version switcher in the top-right corner of the page to download/install other versions.

Alternative installation methods
================================
Although *not currently recommended*,
advanced users may wish to use one of the :ref:`alternative installation methods <alternative_install>`.


#############
Configuration
#############

{{ app_name }} uses a config file to control details of how it executes workflows.
A :ref:`default config file <default_config>` will be created the first time you submit a workflow.
This will work without modification on a personal machine,
however if you are using {{ app_name }} on HPC you will likely need to make some
modifications to describe the job scheduler, and settings for multiple cores,
and to point to your {{ app_name }} environments file.

`Some examples <https://github.com/hpcflow/matflow-configs>`_ are given
for the University of Manchester's CSF.

The path to your config file can be found using ``{{ app_module }} manage get-config-path``,
or to open the config file directly, use ``{{ app_module }} open config``.

#############
Environments
#############

{{ app_name }} has the concept of environments, similar to python virtual environments.
These are required so that tasks can run using the specific software they require.
Your {{ app_name }} environments must be defined in your environments (YAML) file before {{ app_name }}
can run workflows, and this environment file must be pointed to in the config file
via the ``environment_sources`` key.
Once this has been done,
your environment file can be be opened using ``{{ app_module }} open env-source``.

Below is an example environments file that defines environment for some commonly used software.
This is not a complete list of all the software that can be used with {{ app_name }},
and domain-specific tools can be added to the environments file as required.

You may wish to use this as a tempalte and modify it for your own computer,
in particular the ``setup`` sections for each environment.

.. code-block:: yaml

- name: matlab_env
setup: |
module load apps/binapps/matlab/R2019a
module load apps/binapps/matlab/third-party-toolboxes/mtex/5.3
executables:

- label: compile_mtex
instances:
- command: compile-mtex <<script_name>> <<args>>
num_cores: 1
parallel_mode: null

- label: run_compiled_mtex
instances:
- command: ./run_<<script_name>>.sh $MATLAB_HOME <<args>>
num_cores: 1
parallel_mode: null

- label: run_mtex
instances:
- command: matlab -singleCompThread -batch "<<script_name_no_ext>> <<args>>"
num_cores: 1
parallel_mode: null
- command: matlab -batch "<<script_name_no_ext>> <<args>>"
num_cores:
start: 2
stop: 16
parallel_mode: null

- name: python_env
executables:
- label: python_script
instances:
- command: python <<script_name>> <<args>>
num_cores:
start: 1
stop: 32
parallel_mode: null

- name: dream_3D_env
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if Dream3D is a material science specific tool or general enough to be relevant to HPCflow users too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll only want to include the python_env example here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we need to update: command: python <<script_name>> <<args>> to command: python "<<script_path>>" <<args>>

executables:
- label: dream_3D_runner
instances:
- command: /full/path/to/dream3d/DREAM3D-6.5.171-Linux-x86_64/bin/PipelineRunner
num_cores: 1
parallel_mode: null
- label: python_script
instances:
- command: python <<script_name>> <<args>>
num_cores: 1
parallel_mode: null
2 changes: 2 additions & 0 deletions docs/source/reference/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Configuration file

Configurable settings that can be set within the configuration file are listed here.

.. _default_config:

Default config file
~~~~~~~~~~~~~~~~~~~

Expand Down
84 changes: 83 additions & 1 deletion docs/source/reference/glossary.rst
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file needs to be within a.. jinja:: first_ctx block.

Original file line number Diff line number Diff line change
@@ -1,7 +1,89 @@
Glossary
========

workflow
API
---

Application programming interface. {{ app_name }}'s API allows us to design and execute workflows from within a Python interpreter or Jupyter notebook.

.. _def_command_files:

Command files
-------------
If you want to refer to any files that are used as inputs or output,
they should be listed under ``command_files`` in the workflow file

.. code-block:: console

command_files:
- label: new_inp_file
name:
name: friction_conductance.inp


CLI
---

Command line interface. The CLI is typically how we interact with {{ app_name }} on HPC systems.

cluster
-------

See HPC


Environment/virtual environment
-------------------------------

An environment is an isolated set of installed software.
Using environments allows you to have multiple copies of the same software installed in different environments so you can run different versions, or to run two pieces of software with competing dependencies on the same machine.
Using and sharing environments helps make your work reproducible because someone can use the same environment on a different machine and be sure they have the same versions of everything.


HPC
---

High-performance computer/computing


jobscript
---------

A job submission script that is used to queue a job on a batch scheduler system, such as SLURM or SGE.
Jobscripts are generated by {{ app_name }} during workflow submission.

.. _def_task:

Tasks
-------------
These are actual usages of a :ref:`task schema <def_task_schema>`, run with defined inputs.

.. _def_task_schema:

Task schema
-------------
This is a template for a task you want to run,
with definitions of the input and outputs that are expected.

{{ app_name }} has many :ref:`built-in task schemas <task_schemas>`, but you may want to write your own.

.. _def_workflow:

Workflow
--------

A pipeline that processes data in some way.
A workflow is a list of tasks that run one after the other.


.. _def_workflow_template:

Workflow template
------------------

A workflow template parameterises a workflow,
providing the required input values for the task schemas of the workflow.
However, it doesn't actually run the :ref:`workflow <def_workflow>`.
A workflow template is usually just the list of tasks,
but can optionally include {{ app_name }} environment,
the :ref:`task schemas <def_task_schema>`, and the :ref:`command files <def_command_files>`.
12 changes: 12 additions & 0 deletions docs/source/reference/index.rst
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't include this file in the shared docs because hpcflow has an additional page that must be linked from here (SDK).

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Reference
=========

.. toctree::
:maxdepth: 2

Python API <api>
Command-line interface <cli>
Template components <template_components>
Demo workflows <workflows>
Configuration file <config_file>
Glossary <glossary>
2 changes: 2 additions & 0 deletions docs/source/reference/template_components/task_schemas.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _task_schemas:

Task schemas
============

Expand Down
Loading