Skip to content
Merged
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
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ Renku commands with the `-S` flag, as in `renku -S <command>`. More
information on Git LFS usage in renku can be found in the `Data in Renku
<https://renku.readthedocs.io/en/latest/user/data.html>`_ section of the docs.

Renku uses CWL to execute recorded workflows when calling `renku update`
or `renku rerun`. CWL depends on NodeJs to execute the workflows, so installing
`NodeJs <https://nodejs.org/en/download/package-manager/>`_ is required if
you want to use those features.


.. _pipx-before-reference:

Expand Down
2 changes: 1 addition & 1 deletion renku/core/commands/rerun.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

def rerun_workflows():
"""Recreate files generated by a sequence of ``run`` commands."""
return Command().command(_rerun_workflows).require_migration().require_clean().with_commit()
return Command().command(_rerun_workflows).require_migration().require_clean().with_commit().require_nodejs()


def _rerun_workflows(client, revision, roots, siblings, inputs, paths):
Expand Down
2 changes: 1 addition & 1 deletion renku/core/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

def update_workflows():
"""Update existing files by rerunning their outdated workflow."""
return Command().command(_update_workflows).require_migration().require_clean().with_commit()
return Command().command(_update_workflows).require_migration().require_clean().with_commit().require_nodejs()


def _update_workflows(client, revision, no_output, update_all, siblings, paths):
Expand Down
12 changes: 12 additions & 0 deletions renku/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,3 +462,15 @@ class RenkuSaveError(RenkuException):

class DatasetImageError(RenkuException):
"""Raised when a local dataset image is not accessible."""


class NodeNotFoundError(RenkuException):
"""Raised when NodeJs is not installed on the system."""

def __init__(self):
"""Build a custom message."""
msg = (
"NodeJs could not be found on this system\n"
"Please install it, for details see https://nodejs.org/en/download/package-manager/"
)
super(NodeNotFoundError, self).__init__(msg)
28 changes: 28 additions & 0 deletions renku/core/incubation/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import contextlib
import functools
import shutil
from collections import defaultdict

import click
Expand Down Expand Up @@ -251,6 +252,11 @@ def require_clean(self):
"""Check that the repository is clean."""
return RequireClean(self)

@check_finalized
def require_nodejs(self):
"""Ensure nodejs is installed."""
return RequireNodeJs(self)

@check_finalized
def with_communicator(self, communicator):
"""Create a communicator."""
Expand Down Expand Up @@ -407,6 +413,28 @@ def build(self):
return self._builder.build()


class RequireNodeJs(Command):
"""Check that node.js is installed and available on the system."""

DEFAULT_ORDER = 3

def __init__(self, builder):
"""__init__ of DatasetLock."""
self._builder = builder

def _pre_hook(self, builder, context, *args, **kwargs):
"""Check node is available."""
if not shutil.which("nodejs") and not shutil.which("node"):
raise errors.NodeNotFoundError()

@check_finalized
def build(self):
"""Build the command."""
self._builder.add_pre_hook(self.DEFAULT_ORDER, self._pre_hook)

return self._builder.build()


class Communicator(Command):
"""Hook for logging and interaction with user."""

Expand Down
2 changes: 1 addition & 1 deletion renku/core/incubation/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def _status(client):
def update():
"""Return a command for generating the graph."""
command = Command().command(_update).lock_project()
return command.require_migration().with_commit(commit_if_empty=False).require_clean()
return command.require_migration().with_commit(commit_if_empty=False).require_clean().require_nodejs()


def _update(client, dry_run):
Expand Down