- def _get_duts(self) -> list:
- """Get the list of DUTs from the pre-processed information about jobs.
-
- :returns: Alphabeticaly sorted list of DUTs.
- :rtype: list
- """
- return sorted(list(self.df_job_info["dut"].unique()))
-
- def _get_ttypes(self, dut: str) -> list:
- """Get the list of test types from the pre-processed information about
- jobs.
-
- :param dut: The DUT for which the list of test types will be populated.
- :type dut: str
- :returns: Alphabeticaly sorted list of test types.
- :rtype: list
- """
- return sorted(list(self.df_job_info.loc[(
- self.df_job_info["dut"] == dut
- )]["ttype"].unique()))
-
- def _get_cadences(self, dut: str, ttype: str) -> list:
- """Get the list of cadences from the pre-processed information about
- jobs.
-
- :param dut: The DUT for which the list of cadences will be populated.
- :param ttype: The test type for which the list of cadences will be
- populated.
- :type dut: str
- :type ttype: str
- :returns: Alphabeticaly sorted list of cadences.
- :rtype: list
- """
- return sorted(list(self.df_job_info.loc[(
- (self.df_job_info["dut"] == dut) &
- (self.df_job_info["ttype"] == ttype)
- )]["cadence"].unique()))
-
- def _get_test_beds(self, dut: str, ttype: str, cadence: str) -> list:
- """Get the list of test beds from the pre-processed information about
- jobs.
-
- :param dut: The DUT for which the list of test beds will be populated.
- :param ttype: The test type for which the list of test beds will be
- populated.
- :param cadence: The cadence for which the list of test beds will be
- populated.
- :type dut: str
- :type ttype: str
- :type cadence: str
- :returns: Alphabeticaly sorted list of test beds.
- :rtype: list
- """
- return sorted(list(self.df_job_info.loc[(
- (self.df_job_info["dut"] == dut) &
- (self.df_job_info["ttype"] == ttype) &
- (self.df_job_info["cadence"] == cadence)
- )]["tbed"].unique()))
-
- def _get_job(self, dut, ttype, cadence, testbed):
- """Get the name of a job defined by dut, ttype, cadence, test bed.
- Input information comes from the control panel.
-
- :param dut: The DUT for which the job name will be created.
- :param ttype: The test type for which the job name will be created.
- :param cadence: The cadence for which the job name will be created.
- :param testbed: The test bed for which the job name will be created.
- :type dut: str
- :type ttype: str
- :type cadence: str
- :type testbed: str
- :returns: Job name.
- :rtype: str
- """
- return self.df_job_info.loc[(
- (self.df_job_info["dut"] == dut) &
- (self.df_job_info["ttype"] == ttype) &
- (self.df_job_info["cadence"] == cadence) &
- (self.df_job_info["tbed"] == testbed)
- )]["job"].item()
-
- @staticmethod
- def _generate_options(opts: list) -> list:
- """Return list of options for radio items in control panel. The items in
- the list are dictionaries with keys "label" and "value".
-
- :params opts: List of options (str) to be used for the generated list.
- :type opts: list
- :returns: List of options (dict).
- :rtype: list
- """
- return [{"label": i, "value": i} for i in opts]
-
- def _set_job_params(self, job: str) -> dict:
- """Create a dictionary with all options and values for (and from) the
- given job.
-
- :params job: The name of job for and from which the dictionary will be
- created.
- :type job: str
- :returns: Dictionary with all options and values for (and from) the
- given job.
- :rtype: dict
- """
-
- lst_job = job.split("-")
- return {
- "job": job,
- "dut": lst_job[1],
- "ttype": lst_job[3],
- "cadence": lst_job[4],
- "tbed": "-".join(lst_job[-2:]),
- "duts": self._generate_options(self._get_duts()),
- "ttypes": self._generate_options(self._get_ttypes(lst_job[1])),
- "cadences": self._generate_options(self._get_cadences(
- lst_job[1], lst_job[3])),
- "tbeds": self._generate_options(self._get_test_beds(
- lst_job[1], lst_job[3], lst_job[4]))
- }
-