@@ -37,33 +37,33 @@ class Task:
3737 :param cores: Number of cores required by the task.
3838 :type cores: float
3939 :param task_id: Job unique ID (e.g., ID0000001).
40- :type task_id: str
40+ :type task_id: Optional[ str]
4141 :param category: Job category (can be used, for example, to define jobs that use the same program).
42- :type category: str
42+ :type category: Optional[ str]
4343 :param machine: Machine on which is the task has been executed.
44- :type machine: Machine
44+ :type machine: Optional[ Machine]
4545 :param program: Program name.
46- :type program: str
46+ :type program: Optional[ str]
4747 :param args: List of task arguments.
48- :type args: List[str]
48+ :type args: Optional[ List[str] ]
4949 :param avg_cpu: Average CPU utilization in %.
50- :type avg_cpu: float
50+ :type avg_cpu: Optional[ float]
5151 :param bytes_read: Total bytes read in KB.
52- :type bytes_read: int
52+ :type bytes_read: Optional[ int]
5353 :param bytes_written: Total bytes written in KB.
54- :type bytes_written: int
54+ :type bytes_written: Optional[ int]
5555 :param memory: Memory (resident set) size of the process in KB.
56- :type memory: int
56+ :type memory: Optional[ int]
5757 :param energy: Total energy consumption in kWh.
58- :type energy: int
58+ :type energy: Optional[ int]
5959 :param avg_power: Average power consumption in W.
60- :type avg_power: float
60+ :type avg_power: Optional[ float]
6161 :param priority: Task priority.
62- :type priority: int
62+ :type priority: Optional[ int]
6363 :param files: List of input/output files used by the task.
64- :type files: List[File]
64+ :type files: Optional[ List[File] ]
6565 :param logger: The logger where to log information/warning or errors.
66- :type logger: Logger
66+ :type logger: Optional[ Logger]
6767 """
6868
6969 def __init__ (self ,
@@ -75,15 +75,15 @@ def __init__(self,
7575 category : Optional [str ] = None ,
7676 machine : Optional [Machine ] = None ,
7777 program : Optional [str ] = None ,
78- args : List [str ] = [] ,
78+ args : Optional [ List [str ]] = None ,
7979 avg_cpu : Optional [float ] = None ,
8080 bytes_read : Optional [int ] = None ,
8181 bytes_written : Optional [int ] = None ,
8282 memory : Optional [int ] = None ,
8383 energy : Optional [int ] = None ,
8484 avg_power : Optional [float ] = None ,
8585 priority : Optional [int ] = None ,
86- files : List [File ] = [] ,
86+ files : Optional [ List [File ]] = None ,
8787 logger : Optional [Logger ] = None
8888 ) -> None :
8989 """A task in a workflow."""
@@ -95,20 +95,18 @@ def __init__(self,
9595 self .task_id : Optional [str ] = task_id
9696 self .category : Optional [str ] = category
9797 self .program : Optional [str ] = program
98- self .args : List [str ] = args
98+ self .args : List [str ] = args if args else []
9999 self .avg_cpu : Optional [float ] = avg_cpu
100100 self .bytes_read : Optional [int ] = bytes_read
101101 self .bytes_written : Optional [int ] = bytes_written
102102 self .memory : Optional [int ] = memory
103103 self .energy : Optional [int ] = energy
104104 self .avg_power : Optional [float ] = avg_power
105- self .files : List [File ] = files
105+ self .files : List [File ] = files if files else []
106106 self .machine : Machine = machine
107- self .priority = priority
107+ self .priority : Optional [ int ] = priority
108108
109- self .logger .debug ("created {0} task {1}: runtime => {2} seconds." .format (
110- self .type , self .name , self .runtime )
111- )
109+ self .logger .debug (f"created { self .type } task { self .name } : runtime => { self .runtime } seconds." )
112110
113111 def as_dict (self ) -> Dict :
114112 """A JSON representation of the task.
0 commit comments