Skip to content

Commit

Permalink
main changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tainagdcoleman committed Sep 27, 2024
2 parents 6586c51 + a47cc05 commit f1ea7ce
Show file tree
Hide file tree
Showing 35 changed files with 704 additions and 407 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
name: Build

on:
push:
branches:
- main
on: push

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
sudo apt-get install -y python3-sphinx sphinx-rtd-theme-common
pip install sphinx_rtd_theme recommonmark
pip install sphinx_rtd_theme recommonmark pytest pytest-cov
- name: Check package install
run: |
pip install .
pip install -e .
- name: Run tests
run: pytest -m unit --cov=wfcommons tests/

- name: Upload coverage
if: github.ref == 'refs/heads/main'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Build documentation
run: |
cd docs
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ venv
# Workflow Schema
workflow-schema.json

# Binaries
bin/cpu-benchmark
bin/cpu-benchmark.o

# wfc-1.3_to_dask specifics
/wfcommons/wfc-1.3_to_dask/__pycache__/
/wfcommons/wfc-1.3_to_dask/.coverage
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![License: LGPL v3][license-badge]](LICENSE)
[![CodeFactor][codefactor-badge]][codefactor-link]
[![Documentation Status][rtd-badge]][rtd-link]
[![Codecov][cov-badge]][cov-link]
[![Downloads](https://static.pepy.tech/personalized-badge/wfcommons?period=total&units=international_system&left_color=grey&right_color=yellowgreen&left_text=Downloads)](https://pepy.tech/project/wfcommons)

<a href="https://wfcommons.org" target="_blank"><img src="https://wfcommons.org/images/wfcommons-horizontal.png" width="350" /></a>
Expand All @@ -20,7 +21,7 @@ This Python package provides a collection of tools for:
## Installation

WfCommons is available on [PyPI](https://pypi.org/project/wfcommons).
WfCommons requires Python3.8+ and has been tested on Linux and macOS.
WfCommons requires Python3.9+ and has been tested on Linux and macOS.

### Installation using pip

Expand Down Expand Up @@ -114,3 +115,5 @@ that paper, as it provides a recent and general overview on the framework.
[codefactor-link]: https://www.codefactor.io/repository/github/wfcommons/wfcommons
[rtd-badge]: https://readthedocs.org/projects/wfcommons/badge/?version=latest
[rtd-link]: https://wfcommons.readthedocs.io/en/latest/?badge=latest
[cov-badge]: https://codecov.io/gh/wfcommons/WfCommons/graph/badge.svg?token=PJTXMLCIXD
[cov-link]: https://codecov.io/gh/wfcommons/WfCommons
12 changes: 7 additions & 5 deletions bin/wfbench
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021-2024 The WfCommons Team.
Expand Down Expand Up @@ -125,9 +125,10 @@ def cpu_mem_benchmark(cpu_threads: Optional[int] = 5,
os.sched_setaffinity(cpu_proc.pid, {core})
cpu_procs.append(cpu_proc)

mem_proc = subprocess.Popen(mem_prog)
if core:
os.sched_setaffinity(mem_proc.pid, {core})
if mem_threads > 0:
mem_proc = subprocess.Popen(mem_prog)
if core:
os.sched_setaffinity(mem_proc.pid, {core})

return cpu_procs

Expand Down Expand Up @@ -261,8 +262,9 @@ def main():
if core:
print(f"[WfBench] {args.name} acquired core {core}")

mem_threads=int(10 - 10 * args.percent_cpu)
cpu_procs = cpu_mem_benchmark(cpu_threads=int(10 * args.percent_cpu),
mem_threads=int(10 - 10 * args.percent_cpu),
mem_threads=mem_threads,
cpu_work=sys.maxsize if args.time else int(args.cpu_work),
core=core,
total_mem=args.mem)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/generating_workflow_benchmarks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ workflow benchmark for running with Nextflow::

# generate a Nextflow workflow
translator = NextflowTranslator(benchmark.workflow)
translator.translate(output_file_name=pathlib.Path("/tmp/benchmark-workflow.nf"))
translator.translate(output_file_path=pathlib.Path("/tmp/benchmark-workflow.nf"))

.. warning::

Expand Down
2 changes: 1 addition & 1 deletion docs/source/quickstart_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Installation
============

WfCommons is available on `PyPI <https://pypi.org/project/wfcommons>`_.
WfCommons requires Python3.6+ and has been tested on Linux and macOS.
WfCommons requires Python3.9+ and has been tested on Linux and macOS.

Installation using pip
----------------------
Expand Down
70 changes: 70 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[build-system]
requires = ["setuptools>=65.5.1"] # PEP 518 specifications
build-backend = "setuptools.build_meta"

[project]
name = "wfcommons"
authors = [{name = "WfCommons team", email = "[email protected]"}]
description = "A Framework for Enabling Scientific Workflow Research and Education"
readme = "README.md"
requires-python = ">=3.9"
classifiers = [
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Topic :: Documentation :: Sphinx",
"Topic :: System :: Distributed Computing"
]
license = {text = "GNU General Public License v3 (GPLv3)"}
dependencies = [
"jsonschema",
"matplotlib",
"networkx",
"numpy",
"pandas",
"python-dateutil",
"requests",
"scipy",
"pyyaml",
"pandas",
"stringcase"
]
dynamic = ["version"]

[project.urls]
Homepage = "https://wfcommons.org"
Source = "https://github.com/wfcommons/wfcommons"
Documentation = "https://docs.wfcommons.org"
Tracker = "https://github.com/wfcommons/WfCommons/issues"

[project.optional-dependencies]
test = ["pytest", "pytest-cov"]

[tool.setuptools.dynamic]
version = {attr = "wfcommons.version.__version__"}

[tool.pytest.ini_options]
addopts="""
--cov-context test \
--cov-config pyproject.toml \
--cov-report xml:coverage.xml \
--cov-report term-missing \
--cov ./wfcommons \
--ignore wfcommons/wfbench/translator/templates \
--no-cov-on-fail \
-ra \
-W ignore"""
testpaths = [
"tests"
]
markers = [
"unit: Mark a test as a unit test"
]
12 changes: 0 additions & 12 deletions requirements.txt

This file was deleted.

46 changes: 0 additions & 46 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,59 +25,13 @@ def run(self):
sys.exit(-1)
super().run()


with open('README.md', 'r') as fh:
long_description = fh.read()

# Fetch the version
exec(open('wfcommons/version.py').read())

setup(
name='wfcommons',
version=str(__version__),
license='LGPLv3',
author='WfCommons team',
author_email='[email protected]',
description='A Framework for Enabling Scientific Workflow Research and Education',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/wfcommons/wfcommons',
packages=find_packages(),
include_package_data=True,
has_ext_modules=lambda: True,
cmdclass={
'build_ext': Build,
},
install_requires=[
'jsonschema',
'matplotlib',
'networkx',
'numpy',
'python-dateutil',
'requests',
'scipy',
'setuptools',
'pyyaml',
'pandas',
'stringcase'
],
classifiers=[
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Natural Language :: English',
'Topic :: Documentation :: Sphinx',
'Topic :: System :: Distributed Computing'
],
python_requires='>=3.8',
data_files=[
('bin', ['bin/cpu-benchmark', 'bin/wfbench'])
],
Expand Down
60 changes: 60 additions & 0 deletions tests/unit/test_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2024 The WfCommons Team.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

import pytest

from wfcommons.common import Task, TaskType, File, FileLink, Machine, MachineSystem


task_name = "Task Test"
task_id = "task_test_1"
input_files = [File(file_id="file_in_1", size=10, link=FileLink.INPUT), File(file_id="file_in_2", size=20, link=FileLink.INPUT)]
output_files = [File(file_id="file_out_1", size=30, link=FileLink.OUTPUT), File(file_id="file_out_2", size=40, link=FileLink.OUTPUT)]


class TestTask:

@pytest.fixture
def task(self) -> Task:
return Task(
name=task_name,
task_id=task_id,
runtime=123.45,
input_files=input_files,
output_files=output_files,
category="task_test",
machines=[Machine(name="machine_1", cpu = {"coreCount": 48, "speedInMHz": 1200, "vendor": "Vendor Name"})],
program="program",
args=["arg_1", "arg_2"],
avg_cpu=0.5,
bytes_read=12345,
bytes_written=54321,
memory=10,
energy=100,
avg_power=1.0,
priority=100,
executedAt="2024-09-15T08:59:33.699321-04:00",
task_type=TaskType.COMPUTE,
launch_dir="/tmp",
)

@pytest.mark.unit
def test_task_specification(self, task: Task) -> None:

task_specification = {
"name": task_name,
"id": task_id,
"parents": [],
"children": [],
"inputFiles": [str(f) for f in input_files],
"outputFiles": [str(f) for f in output_files]
}

assert(task_specification == task.specification_as_dict())
Loading

0 comments on commit f1ea7ce

Please sign in to comment.