# Buggy code
def _status(self):
    """Get the status of a list of jobs identified by the job identifiers
    returned from the submit request.

    Returns:
         - A list of JobStatus objects corresponding to each job_id in the job_ids list.

    Raises:
         - ExecutionProviderException or its subclasses

    """

    cmd = "qstat"

    retcode, stdout, stderr = self.execute_wait(cmd)

    # Execute_wait failed. Do no update
    if retcode != 0:
        return

    jobs_missing = list(self.resources.keys())
    for line in stdout.split("\n"):
        parts = line.split()
        if (
            parts
            and parts[0].lower().lower() != "job-id"
            and not parts[0].startswith("----")
        ):
            job_id = parts[0]
            status = translate_table.get(parts[4].lower(), JobState.UNKNOWN)
            if job_id in self.resources:
                self.resources[job_id]["status"] = status
                jobs_missing.remove(job_id)

    # Filling in missing blanks for jobs that might have gone missing
    # we might lose some information about why the jobs failed.
    for missing_job in jobs_missing:
        self.resources[missing_job]["status"] = JobStatus(JobState.COMPLETED)


# Traceback (AttributeError)
2020-06-01 13:40:16.122 parsl.dataflow.task_status_poller:62 [DEBUG]  Polling
2020-06-01 13:40:16.126 parsl.dataflow.flow_control:114 [ERROR]  Flow control callback threw an exception - logging and proceeding anyway
Traceback (most recent call last):
File "/home/benc/parsl/src/parsl/parsl/dataflow/flow_control.py", line 112, in make_callback
self.callback(tasks=self._event_buffer, kind=kind)
File "/home/benc/parsl/src/parsl/parsl/dataflow/task_status_poller.py", line 64, in poll
self._strategy.strategize(self._poll_items, tasks)
File "/home/benc/parsl/src/parsl/parsl/dataflow/strategy.py", line 198, in _strategy_simple
running = sum([1 for x in status.values() if x.state == JobState.RUNNING])
File "/home/benc/parsl/src/parsl/parsl/dataflow/strategy.py", line 198, in <listcomp>
running = sum([1 for x in status.values() if x.state == JobState.RUNNING])
AttributeError: 'JobState' object has no attribute 'state'

# Fixed code
def _status(self):
    """Get the status of a list of jobs identified by the job identifiers
    returned from the submit request.

    Returns:
         - A list of JobStatus objects corresponding to each job_id in the job_ids list.

    Raises:
         - ExecutionProviderException or its subclasses

    """

    cmd = "qstat"

    retcode, stdout, stderr = self.execute_wait(cmd)

    # Execute_wait failed. Do no update
    if retcode != 0:
        return

    jobs_missing = list(self.resources.keys())
    for line in stdout.split("\n"):
        parts = line.split()
        if (
            parts
            and parts[0].lower().lower() != "job-id"
            and not parts[0].startswith("----")
        ):
            job_id = parts[0]
            state = translate_table.get(parts[4].lower(), JobState.UNKNOWN)
            if job_id in self.resources:
                self.resources[job_id]["status"] = JobStatus(state)
                jobs_missing.remove(job_id)

    # Filling in missing blanks for jobs that might have gone missing
    # we might lose some information about why the jobs failed.
    for missing_job in jobs_missing:
        self.resources[missing_job]["status"] = JobStatus(JobState.COMPLETED)