emodpy.utils module

class emodpy.utils.EradicationPlatformExtension(value)[source]

Bases: Enum

An enumeration.

LINUX = ''
Windows = '.exe'
class emodpy.utils.EradicationBambooBuilds(value)[source]

Bases: Enum

An enumeration.

GENERIC_LINUX = 'DTKGENCI-SCONSLNXGEN'
GENERIC_WIN = 'DTKGENCI-SCONSWINGEN'
GENERIC = 'DTKGENCI-SCONSLNXGEN'
TBHIV_LINUX = 'DTKTBHIVCI-SCONSRELLNXTBHIV'
TBHIV_WIN = 'DTKTBHIVCI-SCONSWINTBHIV'
TBHIV = 'DTKTBHIVCI-SCONSRELLNXTBHIV'
MALARIA_LINUX = 'DTKMALCI-SCONSLNXMAL'
MALARIA_WIN = 'DTKMALCI-SCONSWINMAL'
MALARIA = 'DTKMALCI-SCONSLNXMAL'
HIV_LINUX = 'DTKHIVCI-SCONSRELLNXHIV'
HIV_WIN = 'DTKHIVCI-RELWINHIV'
HIV = 'DTKHIVCI-SCONSRELLNXHIV'
DENGUE_LINUX = 'DTKDENGCI-SCONSRELLNX'
DENGUE_WIN = 'DTKDENGCI-VSRELWINALL'
DENGUE = 'DTKDENGCI-SCONSRELLNX'
FP_LINUX = 'DTKFPCI-SCONSRELLNX'
FP_WIN = 'DTKFPCI-SCONSWINFP'
FP = 'DTKFPCI-SCONSRELLNX'
TYPHOID_LINUX = 'DTKTYPHCI-SCONSRELLNX'
TYPHOID_WIN = 'DTKTYPHCI-SCONSWINENV'
TYPHOID = 'DTKTYPHCI-SCONSRELLNX'
EMOD_RELEASE = 'EMODREL-SCONSRELLNX'
RELEASE = 'DTKREL-SCONSRELLNX'
class emodpy.utils.BambooArtifact(value)[source]

Bases: Flag

An enumeration.

ERADICATION = 1
SCHEMA = 2
PLUGINS = 4
ALL = 7
emodpy.utils.get_github_eradication_url(version: str, extension: EradicationPlatformExtension = EradicationPlatformExtension.LINUX) str[source]

Get the github eradication url for specified release

Parameters:
  • version – Release to fetch

  • extension – Optional extensions. Defaults to Linux(None)

Returns:

Url of eradication release

emodpy.utils.save_bamboo_credentials(username, password)[source]

Save bamboo api login credentials using keyring.

Parameters:
emodpy.utils.bamboo_api_login()[source]

Automatically login to bamboo, prompt for credentials if none are cached or there’s no login session.

emodpy.utils.download_bamboo_artifacts(plan_key: str, build_num: str | None = None, scheduled_builds_only: bool = True, artifact: BambooArtifact = BambooArtifact.ERADICATION, out_path: str | None = None) list[source]

Downloads artifact(s) for a DTK Bamboo build plan to the specified path

Parameters:
  • plan_key (str) –

  • build_num (str) –

  • scheduled_builds_only (bool) –

  • artifact (BambooArtifact) –

  • out_path (str) – Output path to save file (default to current directory)

Returns:

Returns list of downloaded files on filesystem

emodpy.utils.download_latest_bamboo(plan: EradicationBambooBuilds, scheduled_builds_only: bool = True, out_path: str | None = None) str[source]

Downloads the Eradication binary for the latest successful build for a Bamboo Plan to specified path. Exists for backward compatibility, just a pass-thru to download_latest_eradication().

Parameters:
  • plan – Bamboo Plan key. for supported build

  • out_path – Output path to save file (default to current directory)

Returns:

Returns local filename of downloaded file

emodpy.utils.download_latest_eradication(plan: EradicationBambooBuilds, scheduled_builds_only: bool = True, out_path: str | None = None) str[source]

Downloads the Eradication binary for the latest successful build for a Bamboo Plan to specified path.

Parameters:
  • plan – Bamboo Plan key. for supported build

  • out_path – Output path to save file (default to current directory)

Returns:

Returns local filename of downloaded file

emodpy.utils.download_latest_reporters(plan: EradicationBambooBuilds, scheduled_builds_only: bool = True, out_path: str | None = None) list[source]

Downloads the reporter plugins for the latest successful build for a Bamboo Plan to specified path.

Parameters:
  • plan – Bamboo Plan key. for supported build

  • out_path – Output path to save file (default to current directory)

Returns:

Returns list of local filenames of downloaded files

emodpy.utils.download_latest_schema(plan: EradicationBambooBuilds, scheduled_builds_only: bool = True, out_path: str | None = None) str[source]

Downloads the schema.json for the latest successful build for a Bamboo Plan to specified path.

Parameters:
  • plan – Bamboo Plan key. for supported build

  • out_path – Output path to save file (default to current directory)

Returns:

Returns local filename of downloaded file

emodpy.utils.download_from_url(url, out_path: str | None = None) str[source]
emodpy.utils.download_eradication(url: str, cache_path: str = None, spinner=None)[source]

Downloads Eradication binary

Useful for downloading binaries from Bamboo or Github

Parameters:
  • url – Url to binary

  • cache_path – Optional output directory

  • spinner – Spinner object

Returns:

Full path to output file