Skip to content

Conversation

surendrababuravella
Copy link
Collaborator

SUMMARY

New module zos_started_task which support start, display, modify, cancel, stop and force operations.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

zos_started_task

ADDITIONAL INFORMATION

@surendrababuravella surendrababuravella marked this pull request as draft September 10, 2025 16:54
@surendrababuravella
Copy link
Collaborator Author

surendrababuravella commented Sep 18, 2025

Display command response:

{
    "msg": [
        {
            "changed": true,
            "cmd": "D A,vlf.vlf",
            "failed": false,
            "rc": 0,
            "state": "displayed",
            "stderr": "",
            "stderr_lines": [
                ""
            ],
            "stdout": "EC01248B   2025272  03:33:45.00             ISF031I CONSOLE OMVS0000 ACTIVATED\nEC01248B   2025272  03:33:45.00            -D A,VLF.VLF \nEC01248B   2025272  03:33:45.00             CNZ4106I 03.33.45 DISPLAY ACTIVITY 791\n                                            JOBS     M/S    TS USERS    SYSAS    INITS   ACTIVE/MAX VTAM     OAS\n                                           00013    00014    00000      00033    00037    00000/00020       00022\n                                            VLF      VLF      VLF      NSW  S   A=0062   PER=NO   SMC=000\n                                                                                PGN=N/A  DMN=N/A  AFF=NONE\n                                                                                CT=000.014S  ET=01.24.25\n                                                                                WKL=SYSTEM   SCL=SYSSTC   P=1\n                                                                                RGP=N/A      SRVR=NO  QSC=NO\n                                                                                ADDR SPACE ASTE=1EE16880\n                                                                                DSPNAME=DCSVLLA  ASTE=01302180\n                                                                                DSPNAME=CCSVLLA  ASTE=01302200\n",
            "stdout_lines": [
                "EC01248B   2025272  03:33:45.00             ISF031I CONSOLE OMVS0000 ACTIVATED",
                "EC01248B   2025272  03:33:45.00            -D A,VLF.VLF ",
                "EC01248B   2025272  03:33:45.00             CNZ4106I 03.33.45 DISPLAY ACTIVITY 791",
                "                                            JOBS     M/S    TS USERS    SYSAS    INITS   ACTIVE/MAX VTAM     OAS",
                "                                           00013    00014    00000      00033    00037    00000/00020       00022",
                "                                            VLF      VLF      VLF      NSW  S   A=0062   PER=NO   SMC=000",
                "                                                                                PGN=N/A  DMN=N/A  AFF=NONE",
                "                                                                                CT=000.014S  ET=01.24.25",
                "                                                                                WKL=SYSTEM   SCL=SYSSTC   P=1",
                "                                                                                RGP=N/A      SRVR=NO  QSC=NO",
                "                                                                                ADDR SPACE ASTE=1EE16880",
                "                                                                                DSPNAME=DCSVLLA  ASTE=01302180",
                "                                                                                DSPNAME=CCSVLLA  ASTE=01302200",
                ""
            ],
            "tasks": [
                {
                    "address_space_second_table_entry": "1EE16880",
                    "affinity": "NONE",
                    "asid": "0062",
                    "cpu_time": "000.014S",
                    "dataspaces": [
                        {
                            "data_space_address_entry": "01302180",
                            "data_space_name": "DCSVLLA"
                        },
                        {
                            "data_space_address_entry": "01302200",
                            "data_space_name": "CCSVLLA"
                        }
                    ],
                    "domain_number": "N/A",
                    "elapsed_time": "01.24.25",
                    "priority": "1",
                    "proc_step_name": "VLF",
                    "program_event_recording": "NO",
                    "program_name": "N/A",
                    "queue_scan_count": "NO",
                    "resource_group": "N/A",
                    "server": "NO",
                    "started_class_list": "SYSSTC",
                    "started_time": "2025-09-29 09:09:20.765165+00:00",
                    "system_management_control": "000",
                    "task_identifier": "VLF",
                    "task_name": "VLF",
                    "task_status": "S",
                    "task_type": "NSW",
                    "workload_manager": "SYSTEM"
                }
            ],
            "verbose_output": "NC0000000 EC01248B 25272 03:33:45.56 OMVS0000 00000210  D A,VLF.VLF\nMR0000000 EC01248B 25272 03:33:45.56 OMVS0000 00000010  CNZ4106I 03.33.45 DISPLAY ACTIVITY 791\nLR                                        791 00000010   JOBS     M/S    TS USERS    SYSAS    INITS   ACTIVE/MAX VTAM     OAS\nLR                                        791 00000010  00013    00014    00000      00033    00037    00000/00020       00022\nDR                                        791 00000010   VLF      VLF      VLF      NSW  S   A=0062   PER=NO   SMC=000\nDR                                        791 00000010                                       PGN=N/A  DMN=N/A  AFF=NONE\nDR                                        791 00000010                                       CT=000.014S  ET=01.24.25\nDR                                        791 00000010                                       WKL=SYSTEM   SCL=SYSSTC   P=1\nDR                                        791 00000010                                       RGP=N/A      SRVR=NO  QSC=NO\nDR                                        791 00000010                                       ADDR SPACE ASTE=1EE16880\nDR                                        791 00000010                                       DSPNAME=DCSVLLA  ASTE=01302180\nER                                        791 00000010                                       DSPNAME=CCSVLLA  ASTE=01302200\nN 0000000 EC01248B 25272 03:33:45.57 STC00159 00000210  IEA631I  OPERATOR OMVS0000 NOW INACTIVE, SYSTEM=EC01248B, LU=OMVSADM\nNR0000000 EC01248B 25272 03:33:45.60 STC00159 00000010  CNZ4000I EMCS CONSOLE OMVS0000 HAS BEEN REMOVED"
        }
    ]
}

@surendrababuravella
Copy link
Collaborator Author

surendrababuravella commented Sep 18, 2025

Start command response with verbose:

{
    "msg": [
        {
            "changed": true,
            "cmd": "S sample",
            "failed": false,
            "rc": 0,
            "state": "started",
            "stderr": "",
            "stderr_lines": [
                ""
            ],
            "stdout": "EC01248B   2025272  03:44:00.00             ISF031I CONSOLE OMVS0000 ACTIVATED\nEC01248B   2025272  03:44:00.00            -S SAMPLE \nEC01248B   2025272  03:44:00.00             ",
            "stdout_lines": [
                "EC01248B   2025272  03:44:00.00             ISF031I CONSOLE OMVS0000 ACTIVATED",
                "EC01248B   2025272  03:44:00.00            -S SAMPLE ",
                "EC01248B   2025272  03:44:00.00             "
            ],
            "tasks": [
                {
                    "address_space_second_table_entry": "1EE16580",
                    "affinity": "NONE",
                    "asid": "0056",
                    "cpu_time": "000.003S",
                    "domain_number": "N/A",
                    "elapsed_time": "001.335S",
                    "priority": "1",
                    "proc_step_name": "STEP1",
                    "program_event_recording": "NO",
                    "program_name": "N/A",
                    "queue_scan_count": "NO",
                    "resource_group": "N/A",
                    "server": "NO",
                    "started_class_list": "SYSSTC",
                    "started_time": "2025-09-29 10:43:59.583172+00:00",
                    "system_management_control": "000",
                    "task_identifier": "SAMPLE",
                    "task_name": "SAMPLE",
                    "task_status": "SO",
                    "task_type": "IN",
                    "userid": "USRT001",
                    "work_unit_identifier": "STC00173",
                    "workload_manager": "SYSTEM"
                }
            ],
            "verbose_output": "NC0000000 EC01248B 25272 03:43:59.49 OMVS0000 00000210  S SAMPLE\nN 0200000 EC01248B 25272 03:43:59.50 STC00173 00000201  $HASP100 SAMPLE   ON STCINRDR\nN 0020000 EC01248B 25272 03:43:59.53 STC00173 00000201  IEF695I START SAMPLE   WITH JOBNAME SAMPLE   IS ASSIGNED TO USER USRT001\nS                                                        , GROUP SYS1\nN 4000000 EC01248B 25272 03:43:59.53 STC00173 00000010  $HASP373 SAMPLE   STARTED\nN 0000000 EC01248B 25272 03:44:00.51 STC00158 00000210  IEA631I  OPERATOR OMVS0000 NOW INACTIVE, SYSTEM=EC01248B, LU=OMVSADM\nNR0000000 EC01248B 25272 03:44:00.54 STC00158 00000010  CNZ4000I EMCS CONSOLE OMVS0000 HAS BEEN REMOVED"
        }
    ]
}

@surendrababuravella
Copy link
Collaborator Author

surendrababuravella commented Sep 18, 2025

Cancel command response with verbose:

{
    "msg": [
        {
            "changed": true,
            "cmd": "C sample",
            "failed": false,
            "rc": 0,
            "state": "cancelled",
            "stderr": "",
            "stderr_lines": [
                ""
            ],
            "stdout": "EC01248B   2025272  03:46:16.00             ISF031I CONSOLE OMVS0000 ACTIVATED\nEC01248B   2025272  03:46:16.00            -C SAMPLE \nEC01248B   2025272  03:46:16.00             IEE301I SAMPLE            CANCEL COMMAND ACCEPTED\n",
            "stdout_lines": [
                "EC01248B   2025272  03:46:16.00             ISF031I CONSOLE OMVS0000 ACTIVATED",
                "EC01248B   2025272  03:46:16.00            -C SAMPLE ",
                "EC01248B   2025272  03:46:16.00             IEE301I SAMPLE            CANCEL COMMAND ACCEPTED",
                ""
            ],
            "tasks": [
                {
                    "address_space_second_table_entry": "1EE16580",
                    "affinity": "NONE",
                    "asid": "0056",
                    "cpu_time": "000.003S",
                    "domain_number": "N/A",
                    "elapsed_time": "136.476S",
                    "priority": "1",
                    "proc_step_name": "STEP1",
                    "program_event_recording": "NO",
                    "program_name": "N/A",
                    "queue_scan_count": "NO",
                    "resource_group": "N/A",
                    "server": "NO",
                    "started_class_list": "SYSSTC",
                    "started_time": "2025-09-29 10:43:59.584406+00:00",
                    "system_management_control": "000",
                    "task_identifier": "SAMPLE",
                    "task_name": "SAMPLE",
                    "task_status": "SO",
                    "task_type": "OWT",
                    "userid": "USRT001",
                    "work_unit_identifier": "STC00173",
                    "workload_manager": "SYSTEM"
                }
            ],
            "verbose_output": "NC0000000 EC01248B 25272 03:46:16.23 OMVS0000 00000210  C SAMPLE\nNR0000000 EC01248B 25272 03:46:16.23 STC00161 00000010  IEE301I SAMPLE            CANCEL COMMAND ACCEPTED\nN 0000000 EC01248B 25272 03:46:16.23          00000201  IEA989I SLIP TRAP ID=X222 MATCHED.  JOBNAME=SAMPLE  , ASID=0056.\nM 0020000 EC01248B 25272 03:46:16.23 STC00173 00000210  BPXP018I THREAD 0DE1C80000000000, IN PROCESS 16777622, ENDED 985\nD                                         985 00000210  WITHOUT BEING UNDUBBED WITH COMPLETION CODE 40222000\nE                                         985 00000210  , AND REASON CODE 00000000.\nN 4000000 EC01248B 25272 03:46:16.23 STC00173 00000010  IEF450I SAMPLE SAMPLE - ABEND=S222 U0000 REASON=00000000\nN 4000000 EC01248B 25272 03:46:16.24 STC00173 00000010  $HASP395 SAMPLE   ENDED - ABEND=S222\nN 0000000 EC01248B 25272 03:46:16.24          00000201  IEA989I SLIP TRAP ID=X33E MATCHED.  JOBNAME=*UNAVAIL, ASID=0056.\nN 0200000 EC01248B 25272 03:46:16.25 STC00173 00000010  $HASP150 SAMPLE   OUTGRP=1.1.1 ON PRT2     50 (50) RECORDS\nN 0000000 EC01248B 25272 03:46:16.25 STC00161 00000210  IEA631I  OPERATOR OMVS0000 NOW INACTIVE, SYSTEM=EC01248B, LU=OMVSADM\nN 0200000 EC01248B 25272 03:46:16.28          00000201  $HASP160 PRT2       INACTIVE - CLASS=01234AZFWXYTV\nN 0200000 EC01248B 25272 03:46:16.28 STC00173 00000010  $HASP250 SAMPLE PURGED -- (JOB KEY WAS E18FE98D)\nNR0000000 EC01248B 25272 03:46:16.30 STC00161 00000010  CNZ4000I EMCS CONSOLE OMVS0000 HAS BEEN REMOVED"
        }
    ]
}

Copy link
Collaborator

@fernandofloresg fernandofloresg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested few changes, only got to some of the docs will continue later

return contents

def _basic_dict_type(self, contents, resolve_dependencies):
"""Resolver for str type arguments.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Resolver for str type arguments.
"""Resolver for basic dict type arguments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return str(contents)

def _identifier_name_type(self, contents, resolve_dependencies):
"""Resolver for data_set type arguments.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is used only in zos_started task could you comment a bit of where this is used ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

return contents

def _member_name_type(self, contents, resolve_dependencies):
"""Resolver for data_set type arguments.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is used only in zos_started task could you comment a bit of where and how this is used ? I mean, add as a comment in the function, so that is not used for other reasons. Is this member a data set member?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Member is the PDS/E member.

state:
description:
- The desired state the started task should be after the module is executed.
- If state=started and the started task is not found on the managed node, no action is taken,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this behavior should be changed, just checked the ansible.services module and when a service is not found in the managed node it fails

fatal: [zvm]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3.12"}, "changed": false, "msg": "Could not find the requested service hpptt: host"}

This seems more aligned to the idea of idempotency, returning a succesful response with changed: false would give a false sense that the task is running already, even though we can start more than one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified description. Here status of the started task or member are validated by ZOAU.

managed node, no action is taken, module completes successfully with changed=False.
- If state is modified and the started task is not running, not found or modification was not
done, the module will fail.
- If state is displayed the module will return the started task details.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of state being displayed what is the changed return value? could you add that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

default: false
wait_time:
description:
- Option wait_time is the total time that module zos_started_tak will wait for a submitted
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Option wait_time is the total time that module zos_started_tak will wait for a submitted
- Option wait_time is the total time that module zos_started_task will wait for a submitted

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

Copy link
Collaborator

@richp405 richp405 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll wait for you to address fernando's comments on return process from zos_started_task.

Copy link
Collaborator

@rexemin rexemin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work you have done in this module. There's a lot of comments, but they're mostly documentation or reminders of how to do things more in Python's style. Another question I have about cpu_time and elapsed_time: the time returned changes depending on how long the started task has been running for, would it be too cumbersome to convert all those formats into a single one like this: hhhhh.mm.ss.ttt? I'm thinking having the same format all the time would make automation easier. Of course, special values ******** and NOTAVAIL would remain the same.

All comments I've made are probably a lot of work and you've been waiting on more reviews, so if I don't review this PR again quickly please ping me

@surendrababuravella
Copy link
Collaborator Author

Good work you have done in this module. There's a lot of comments, but they're mostly documentation or reminders of how to do things more in Python's style. Another question I have about cpu_time and elapsed_time: the time returned changes depending on how long the started task has been running for, would it be too cumbersome to convert all those formats into a single one like this: hhhhh.mm.ss.ttt? I'm thinking having the same format all the time would make automation easier. Of course, special values ******** and NOTAVAIL would remain the same.

All comments I've made are probably a lot of work and you've been waiting on more reviews, so if I don't review this PR again quickly please ping me

@rexemin Thank you for the review..
'elapsed_time' has handled already. 'started_time' has created from 'elapsed_time' only.
Regarding 'cpu_time', tried to analyse multiple scenarios. The logic which is used for 'elapsed_time' is applicable for this as well. But this can be handled if needed.

Other comments are addressed.

Copy link
Collaborator

@richp405 richp405 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surendra... I think you need to re-push your changes... the 'view changed' did not show changes that you marked as resolved. We need to see the actual changes in github before we can approve it.

@surendrababuravella
Copy link
Collaborator Author

Surendra... I think you need to re-push your changes... the 'view changed' did not show changes that you marked as resolved. We need to see the actual changes in github before we can approve it.

@richp405 this comment applicable at 2 places.. i missed updating here. Now updated..

Copy link
Collaborator

@richp405 richp405 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few document issues remaining in zos_started_task, but not deal busters in my opinion. A nice chunk of code.

Copy link
Collaborator

@rexemin rexemin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty great, thanks for working on so many comments so quickly, I just have a couple of other corrections and some questions from last week pending

else:
module.fail_json(
rc=5,
msg="job_name is missing which is mandatory to display started task details.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are stopping a started task here

else:
module.fail_json(
rc=5,
msg="job_name is missing which is mandatory to display started task details.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are modifying a started task here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants