SubmitJob

submit_job(public_api_client, target_id, job_name, external_job_id, job_type, job_mode, timeout, test_framework, entry_script, job_artifacts, monkey_events, monkey_session_timeout, job_parameters=None)
Expand source code
submit_job(public_api_client, target_id, job_name, external_job_id, job_type, job_mode, timeout, test_framework, entry_script, job_artifacts, monkey_events, monkey_session_timeout, job_parameters=None):
"""
Description
-----------
To submit a new job.
Args
----
public_api_client: QDC api client object.
target_id: Chipset on which job needs to be executed.
job_name: Name of the job user wanted to create.
external_job_id: Job identifier used in external system (value is optional can be None).
job_type: Type of the job, we have only Automated job support.
job_mode: Mode of the job (Application, AI mode etc.). for now, we have application mode support.
timeout: Job timeout in minutes.
test_framework: Framework to be used for test execution (APPIUM, POWERSHELL, MONKEY, BASH).
entry_script: Entry point script will be executed as part of test execution, mandatory for POWERSHELL test framework.
job_artifacts: List of uploaded test artifacts to be used for test execution.
monkey_events: number of monkey test event, needed only for monkey testframework.
monkey_session_timeout: monkey test session timeout in minutes, needed only for monkey testframework.
job_parameters: (optional) device configurations, set this value according to different job_type, job_mode, target_id
Returns
-------
long: Newly submitted job id.
None: In case of any failure.
Usages
------
job_name = "Sample Test Job" # name of the job user wanted to create must be less than 32 chars
external_job_id = "ExJobId001" # job identifier used in external system (value is optional can be None also)
job_type = JobType.AUTOMATED # type of the job, we have only Automated job support
job_mode = JobMode.APPLICATION # mode of the job (Application, AI mode etc.). for now, we have application mode support
timeout = 5 # job timeout in minutes
framework = TestFramework.POWERSHELL # framework to be used for test execution (APPIUM, POWERSHELL, MONKEY, BASH)
entry_script = "test.ps1" # entry point script will be executed as part of test execution, mandatory for POWERSHELL test framework
job_artifacts = [apk_uuid, script_uuid] # list of uploaded test artifacts to be used for test execution
Mobile: Supported test package: apk
Compute: Supported test package: msi, zip
IOT/Automotive: Supported test package: zip
monkey_events = 500 # number of monkey test event, needed only for monkey testframework.
monkey_session_timeout = 100 # monkey test session timeout in minutes, needed only for monkey testframework.
job_parameters = [JobSubmissionParameter.WIFIENABLED] # application scenarios of device configuration
WifiEnabled: Valid in devices except Compute
BluetoothEnabled: Valid in devices except Compute
ScreenAlwaysOn: Not valid in Ubuntu OS / Automotive
GPSEnabled: Not checked
ProfilingEnabled: Only valid in Android OS
RefreshEnabledBeforeJobStart: Not checked
InstallSNPE: Only valid in Compute
SSH ONLY: Only valid in Interactive Job
job_id = qdc_api.submit_job(public_api_client, target_id, job_name, external_job_id, job_type, job_mode, timeout, framework, entry_script, job_artifacts, monkey_events, monkey_session_timeout, job_parameters)
"""
if job_parameters is None:
job_parameters = []
job_creation_payload = CreateJobType0(target_id=target_id,
job_name=job_name,
external_job_id=external_job_id,
job_type=job_type,
job_mode=job_mode,
timeout_in_minutes=timeout,
test_framework=test_framework,
entry_script=entry_script,
job_artifacts=job_artifacts,
monkey_events=monkey_events,
monkey_session_timeout=monkey_session_timeout,
job_parameters=job_parameters)
job_creation_response = post_jobs.sync_detailed(client=_get_client_with_new_trace_header(public_api_client), body=job_creation_payload)
if job_creation_response.status_code == 200:
print(f"Submit job response: {job_creation_response.content.decode('utf-8')}")
job_id = job_creation_response.parsed.job_id
print(f"Job Id: {job_id}")
return job_id
else:
print(
f"Submit a job failed with error code {job_creation_response.status_code} {job_creation_response.content.decode('utf-8')}")
return None
Description
To submit a new job.
Arguments
public_api_client: QDC api client object.
target_id: Chipset on which job needs to be executed.
job_name: Name of the job user wanted to create.
external_job_id: Job identifier used in external system (value is optional can be None).
job_type: Type of the job, we have only Automated job support.
job_mode: Mode of the job (Application, AI mode etc.). for now, we have application mode support.
timeout: Job timeout in minutes.
test_framework: Framework to be used for test execution (APPIUM, POWERSHELL, MONKEY, BASH).
entry_script: Entry point script will be executed as part of test execution, mandatory for POWERSHELL test framework.
job_artifacts: List of uploaded test artifacts to be used for test execution.
monkey_events: number of monkey test event, needed only for monkey testframework.
monkey_session_timeout: monkey test session timeout in minutes, needed only for monkey testframework.
job_parameters: (optional) device configurations, set this value according to different job_type, job_mode, target_id
Returns
long: Newly submitted job id.
None: In case of any failure.
Usages
job_name = "Sample Test Job" # name of the job user wanted to create must be less than 32 chars
external_job_id = "ExJobId001" # job identifier used in external system (value is optional can be None also)
job_type = JobType.AUTOMATED # type of the job, we have only Automated job support
job_mode = JobMode.APPLICATION # mode of the job (Application, AI mode etc.). for now, we have application mode support
timeout = 5 # job timeout in minutes
framework = TestFramework.POWERSHELL # framework to be used for test execution (APPIUM, POWERSHELL, MONKEY, BASH)
entry_script = "test.ps1" # entry point script will be executed as part of test execution, mandatory for POWERSHELL test framework
job_artifacts = [apk_uuid, script_uuid] # list of uploaded test artifacts to be used for test execution
Mobile: Supported test package: apk
Compute: Supported test package: msi, zip
IOT/Automotive: Supported test package: zip
monkey_events = 500 # number of monkey test event, needed only for monkey testframework.
monkey_session_timeout = 100 # monkey test session timeout in minutes, needed only for monkey testframework.
job_parameters = [JobSubmissionParameter.WIFIENABLED] # application scenarios of device configuration
WifiEnabled: Valid in devices except Compute
BluetoothEnabled: Valid in devices except Compute
ScreenAlwaysOn: Not valid in Ubuntu OS / Automotive
GPSEnabled: Not checked
ProfilingEnabled: Only valid in Android OS
RefreshEnabledBeforeJobStart: Not checked
InstallSNPE: Only valid in Compute
SSH ONLY: Only valid in Interactive Job
job_id = qdc_api.submit_job(public_api_client, target_id, job_name, external_job_id, job_type, job_mode, timeout, framework, entry_script, job_artifacts, monkey_events, monkey_session_timeout, job_parameters)