Skip to content

Commit

Permalink
pass job instead of getting it each time
Browse files Browse the repository at this point in the history
  • Loading branch information
ebeesonjanrain committed Mar 14, 2016
1 parent 1d55e22 commit 825ba18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions bluekai/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
from .date_utils import toRecordDateTime
from .records import recordsNewerThan

def run(JobModel, writter, config, logger, datalib, converter):
def run(job, writter, config, logger, datalib, converter):

logger.info("start")

job = JobModel.get(config)
err = None

try:

do_job(JobModel, writter, config, logger, datalib, converter)
do_job(job, writter, config, logger, datalib, converter)

except Exception as ex:

Expand All @@ -26,9 +25,8 @@ def run(JobModel, writter, config, logger, datalib, converter):
job.stop()
logger.info("end ({} seconds)".format(job.ended - job.started))

def do_job(JobModel, writter, config, logger, datalib, converter):
def do_job(job, writter, config, logger, datalib, converter):

job = JobModel.get(config)
last_updated = job.lastUpdated

capture_app = datalib.get_app(
Expand Down Expand Up @@ -56,5 +54,3 @@ def do_job(JobModel, writter, config, logger, datalib, converter):
logger.debug("wrote record {}".format(record_num))

logger.info("exported {} records".format(record_num))

return job
2 changes: 1 addition & 1 deletion bluekai/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _export(config, JobModel, SftpProxy, threadexecutor, logger):

if job.start():
threadexecutor.submit(
jobRunner, JobModel, writter, config, logger,
jobRunner, job, writter, config, logger,
janrain_datalib, bluekai_tsv.fromRecord)
else:
logger.warning("export job already running")

1 comment on commit 825ba18

@akameron
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Please sign in to comment.