Skip to content

Commit

Permalink
Merge pull request #387 from 4dn-dcic/drr_add_kwargs
Browse files Browse the repository at this point in the history
Accept kwargs
  • Loading branch information
drio18 committed Mar 13, 2023
2 parents 0bcb83a + 7e18f39 commit 85b27b6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -3,6 +3,13 @@
Change Log
==========

3.2.2
=====
`PR 387: Add kwargs <https://github.com/4dn-dcic/tibanna/pull/387>`_

* Add kwargs to various class' init methods


3.2.1
=====

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tibanna"
version = "3.2.1"
version = "3.2.2"
description = "Tibanna runs portable pipelines (in CWL/WDL) on the AWS Cloud."
authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion tibanna/ami.py
Expand Up @@ -20,7 +20,7 @@ class AMI(object):
AMI_NAME = 'tibanna-ami-' + datetime.strftime(datetime.today(), '%Y%m%d') # e.g tibanna-ami-20201113
ARCHITECTURE = 'x86'

def __init__(self, base_ami=None, base_region=None, userdata_file=None, ami_name=None, architecture=None):
def __init__(self, base_ami=None, base_region=None, userdata_file=None, ami_name=None, architecture=None, **kwargs):
if base_ami:
self.BASE_AMI = base_ami
elif architecture == 'x86':
Expand Down
18 changes: 10 additions & 8 deletions tibanna/awsem.py
Expand Up @@ -9,7 +9,7 @@


class AwsemRunJson(SerializableObject):
def __init__(self, Job=None, config=None, strict=True):
def __init__(self, Job=None, config=None, strict=True, **kwargs):
if strict:
if not Job or not config:
raise MalFormattedPostRunJsonException("Job and config are required fields.")
Expand All @@ -24,7 +24,7 @@ def create_Job(self, Job, strict=True):

class AwsemRunJsonJob(SerializableObject):
def __init__(self, App=None, Input=None, Output=None, JOBID='',
start_time=None, Log=None, strict=True):
start_time=None, Log=None, strict=True, **kwargs):
if strict:
if App is None or Input is None or Output is None or not JOBID:
raise MalFormattedRunJsonException
Expand Down Expand Up @@ -63,7 +63,7 @@ def start_time_as_datetime(self):


class AwsemRunJsonLog(SerializableObject):
def __init__(self, log_bucket_directory=None):
def __init__(self, log_bucket_directory=None, **kwargs):
self.log_bucket_directory = log_bucket_directory


Expand All @@ -72,7 +72,8 @@ def __init__(self, App_name=None, App_version=None, language=None,
cwl_url=None, main_cwl=None, other_cwl_files=None,
wdl_url=None, main_wdl=None, other_wdl_files=None, workflow_engine=None, run_args=None,
container_image=None, command=None,
snakemake_url=None, main_snakemake=None, other_snakemake_files=None):
snakemake_url=None, main_snakemake=None, other_snakemake_files=None,
**kwargs):
self.App_name = App_name
self.App_version = App_version
self.language = language
Expand All @@ -90,11 +91,12 @@ def __init__(self, App_name=None, App_version=None, language=None,
self.main_snakemake = main_snakemake
self.other_snakemake_files = other_snakemake_files


class AwsemRunJsonInput(SerializableObject):
def __init__(self, Input_files_data=None, Input_parameters=None, Secondary_files_data=None,
# Input_files_reference is for older postrunjson
# Env is missing in older postrunjson
Input_files_reference=None, Env=None):
Input_files_reference=None, Env=None, **kwargs):
if not Input_files_data:
Input_files_data = {}
if not Input_parameters:
Expand Down Expand Up @@ -223,7 +225,7 @@ def as_dict_as_wdl_input(self, input_dir='', input_mount_dir_prefix=''):

class AwsemRunJsonOutput(SerializableObject):
def __init__(self, output_bucket_directory=None, output_target=None,
secondary_output_target=None, alt_cond_output_argnames=None):
secondary_output_target=None, alt_cond_output_argnames=None, **kwargs):
self.output_bucket_directory = output_bucket_directory or {}
self.output_target = output_target or {}
self.secondary_output_target = secondary_output_target or {}
Expand Down Expand Up @@ -269,7 +271,7 @@ def alt_output_target(self, argname_list):


class AwsemPostRunJson(AwsemRunJson):
def __init__(self, Job=None, config=None, commands=None,log=None, strict=True):
def __init__(self, Job=None, config=None, commands=None, log=None, strict=True, **kwargs):
if strict:
if not Job or not config:
raise MalFormattedPostRunJsonException("Job and config are required fields.")
Expand All @@ -292,7 +294,7 @@ def __init__(self, App=None, Input=None, Output=None, JOBID='',
total_input_size=None, total_output_size=None, total_tmp_size=None,
# older postrunjsons don't have these fields
filesystem='', instance_id='', instance_availablity_zone='', instance_type='',
Metrics=None, strict=True):
Metrics=None, strict=True, **kwargs):
if strict:
if App is None or Input is None or Output is None or not JOBID or start_time is None:
errmsg = "App, Input, Output, JOBID and start_time are required fields"
Expand Down
2 changes: 1 addition & 1 deletion tibanna/job.py
Expand Up @@ -35,7 +35,7 @@ def status(job_ids=None, exec_arns=None):

class Job(object):

def __init__(self, job_id=None, exec_arn=None, sfn=None):
def __init__(self, job_id=None, exec_arn=None, sfn=None, **kwargs):
"""A job can be identified with either a job_id or an exec_arn.
For old tibanna versions (with no dynamoDB deployed),
a job can be identified with a job_id and sfn.
Expand Down

0 comments on commit 85b27b6

Please sign in to comment.