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
5 changes: 3 additions & 2 deletions dataduct/pipeline/precondition.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Precondition(PipelineObject):
def __init__(self,
id,
is_directory=True,
s3Prefix=None,
**kwargs):
"""Constructor for the Precondition class

Expand All @@ -25,11 +26,11 @@ def __init__(self,
super(Precondition, self).__init__(
id=id,
type='S3PrefixNotEmpty',
s3Prefix="#{node.directoryPath}",
s3Prefix=s3Prefix if s3Prefix is not None else "#{node.directoryPath}",
)
else:
super(Precondition, self).__init__(
id=id,
type='S3KeyExists',
s3Prefix="#{node.filePath}",
s3Prefix=s3Prefix if s3Prefix is not None else "#{node.filePath}",
)
11 changes: 9 additions & 2 deletions dataduct/pipeline/shell_command_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

from .activity import Activity
from .precondition import Precondition
from ..config import Config
from .schedule import Schedule
from ..utils import constants as const
Expand All @@ -29,7 +30,8 @@ def __init__(self,
command=None,
max_retries=None,
depends_on=None,
additional_s3_files=None):
additional_s3_files=None,
precondition=None):
"""Constructor for the ShellCommandActivity class

Args:
Expand All @@ -55,6 +57,10 @@ def __init__(self,
if command is not None and script_uri is not None:
raise ETLInputError('command and script both can not be provided')

if precondition and not isinstance(precondition, Precondition):
raise ETLInputError(
'Input precondition must be of the type Precondition')

# Set default values
if depends_on is None:
depends_on = []
Expand All @@ -77,7 +83,8 @@ def __init__(self,
schedule=schedule,
scriptUri=script_uri,
scriptArgument=script_arguments,
command=command
command=command,
precondition=precondition
)

# Add the additional s3 files
Expand Down