# Buggy code
def issueBatchJob(self, command, memory, cores, disk):
    """
    Issues the following command returning a unique jobID. Command is the string to run, memory is an int giving
    the number of bytes the job needs to run in and cores is the number of cpus needed for the job and error-file
    is the path of the file to place any std-err/std-out in.
    """
    # puts job into job_type_queue to be run by Mesos, AND puts jobID in current_job[]
    self.checkResourceRequest(memory, cores, disk)
    jobID = self.nextJobID
    self.nextJobID += 1

    job = ToilJob(
        jobID=jobID,
        resources=ResourceRequirement(memory=memory, cores=cores, disk=disk),
        command=command,
        userScript=self.userScript,
        toilDistribution=self.toilDistribution,
    )
    job_type = job.resources

    log.debug(
        "Queueing the job command: %s with job id: %s ..." % (command, str(jobID))
    )
    self.jobQueueList[job_type].append(job)
    log.debug("... queued")

    return jobID


# Traceback (ConfigParser.NoSectionError)
DEBUG:toil.batchSystems.mesos.executor:Starting executor
I0924 22:47:08.587648 43191 exec.cpp:132] Version: 0.22.0
I0924 22:47:08.592193 43192 exec.cpp:206] Executor registered on slave 20150924-214557-83886090-5050-44087-S8
INFO:toil.batchSystems.mesos.executor:Registered with framework
DEBUG:toil.batchSystems.mesos.executor:Running task 0
DEBUG:toil.batchSystems.mesos.executor:Sending status update ...
DEBUG:toil.batchSystems.mesos.executor:Sent status update
DEBUG:toil.batchSystems.mesos.executor:Invoking command: '/usr/bin/python2.7 -E /usr/local/lib/python2.7/dist-packages/toil/worker.py azure:hgvm:tree2 683b1010_55c3_4978_a7e7_853f17ed1803'
DEBUG:toil.batchSystems.mesos.executor:Sent stats message
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/toil/worker.py", line 408, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/toil/worker.py", line 89, in main
jobStore = loadJobStore(jobStoreString)
File "/usr/local/lib/python2.7/dist-packages/toil/common.py", line 366, in loadJobStore
return AzureJobStore( account, namePrefix, config=config )
File "/usr/local/lib/python2.7/dist-packages/toil/jobStores/azureJobStore.py", line 78, in __init__
account_key = _fetchAzureAccountKey(accountName)
File "/usr/local/lib/python2.7/dist-packages/toil/jobStores/azureJobStore.py", line 63, in _fetchAzureAccountKey
return configParser.get('AzureStorageCredentials', accountName)
File "/usr/lib/python2.7/ConfigParser.py", line 330, in get
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'AzureStorageCredentials'
DEBUG:toil.batchSystems.mesos.executor:Sending status update ...
DEBUG:toil.batchSystems.mesos.executor:Sent status update
I0924 22:47:09.738494 43200 exec.cpp:379] Executor asked to shutdown
CRITICAL:toil.batchSystems.mesos.executor:Shutting down executor...
CRITICAL:toil.batchSystems.mesos.executor:Executor shut down

# Fixed code
def issueBatchJob(self, command, memory, cores, disk):
    """
    Issues the following command returning a unique jobID. Command is the string to run, memory is an int giving
    the number of bytes the job needs to run in and cores is the number of cpus needed for the job and error-file
    is the path of the file to place any std-err/std-out in.
    """
    # puts job into job_type_queue to be run by Mesos, AND puts jobID in current_job[]
    self.checkResourceRequest(memory, cores, disk)
    jobID = self.nextJobID
    self.nextJobID += 1

    job = ToilJob(
        jobID=jobID,
        resources=ResourceRequirement(memory=memory, cores=cores, disk=disk),
        command=command,
        userScript=self.userScript,
        toilDistribution=self.toilDistribution,
        environment=self.environment.copy(),
    )
    job_type = job.resources

    log.debug(
        "Queueing the job command: %s with job id: %s ..." % (command, str(jobID))
    )
    self.jobQueueList[job_type].append(job)
    log.debug("... queued")

    return jobID