
import subprocess as sp

from .parser import JobsParser


def get_jobs():
    xml_text = fetch_xml()
    parser = JobsParser(xml_text)
    return parser.jobs


def fetch_xml(user=None):
    cmd = ['qstat', '-xml']
    if user is not None:
        cmd.extend(['-u', user])
    return sp.check_output(list(map(str, cmd)))


import subprocess as sp

from .parser import JobsParser


def get_jobs(user=None):
    xml_text = fetch_xml(user=user)
    parser = JobsParser(xml_text)
    return parser.jobs


def fetch_xml(user=None):
    cmd = ['qstat', '-xml']
    if user is not None:
        cmd.extend(['-u', user])
    return sp.check_output(list(map(str, cmd)))

Add user argument to get_jobs
Add user argument to get_jobs

  
  import subprocess as sp
  
  from .parser import JobsParser
  
  
- def get_jobs():
+ def get_jobs(user=None):
-     xml_text = fetch_xml()
+     xml_text = fetch_xml(user=user)
      parser = JobsParser(xml_text)
      return parser.jobs
  
  
  def fetch_xml(user=None):
      cmd = ['qstat', '-xml']
      if user is not None:
          cmd.extend(['-u', user])
      return sp.check_output(list(map(str, cmd)))
  
Add user argument to get_jobs
## Code Before:

import subprocess as sp

from .parser import JobsParser


def get_jobs():
    xml_text = fetch_xml()
    parser = JobsParser(xml_text)
    return parser.jobs


def fetch_xml(user=None):
    cmd = ['qstat', '-xml']
    if user is not None:
        cmd.extend(['-u', user])
    return sp.check_output(list(map(str, cmd)))

## Instruction:
Add user argument to get_jobs
## Code After:

import subprocess as sp

from .parser import JobsParser


def get_jobs(user=None):
    xml_text = fetch_xml(user=user)
    parser = JobsParser(xml_text)
    return parser.jobs


def fetch_xml(user=None):
    cmd = ['qstat', '-xml']
    if user is not None:
        cmd.extend(['-u', user])
    return sp.check_output(list(map(str, cmd)))
