Repository: oppia/oppia

Issue:
Lint error while pre commit linter runs
I am seeing a new error while running the `pre_commit_linter` script. It also does not cause the lint process to fail.

The error specifically is:
1. 
```
There are no HTML files to lint.
09:14:55 FINISHED custom: 0.0 secs
'TaskThread' object has no attribute 'start_time'
----------------------------------------
09:14:55 ERROR custom: 0.0 secs
```

2. 

```
Exception in thread custom:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "scripts/concurrent_task_utils.py", line 72, in run
    (self.name, time.time() - self.start_time), show_time=True)
AttributeError: 'TaskThread' object has no attribute 'start_time'
```

**Complete log:**
```
Starting Linter....
SUCCESS  Mandatory pattern check passed
----------------------------------------


There are no files to be checked.
09:14:55 FINISHED custom: 0.0 secs
----------------------------------------
SUCCESS  Mandatory pattern check passed


There are no files to be checked.

There are no HTML files to lint.
09:14:55 FINISHED custom: 0.0 secs
'TaskThread' object has no attribute 'start_time'
----------------------------------------
09:14:55 ERROR custom: 0.0 secs
Number of unstarted tasks: 5
----------------------------------------
SUCCESS  Mandatory pattern check passed


----------------------------------------
There are no files to be checked.
09:14:55 FINISHED custom: 0.0 secs

There are no Python files to lint.
'TaskThread' object has no attribute 'start_time'
----------------------------------------
----------------------------------------
SUCCESS  Mandatory pattern check passed


There are no files to be checked.----------------------------------------

09:14:55 FINISHED custom: 0.0 secs
SUCCESS  Mandatory pattern check passed


There are no files to be checked.
----------------------------------------
Tasks still running:
  custom (started 14:44:55)
  custom (started 14:44:55)
  custom (started 14:44:55)
----------------------------------------
09:14:55 FINISHED custom: 0.0 secs
Validating and parsing JS and TS files ...
Exception in thread custom:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "scripts/concurrent_task_utils.py", line 72, in run
    (self.name, time.time() - self.start_time), show_time=True)
AttributeError: 'TaskThread' object has no attribute 'start_time'

SUCCESS  Extra JS files check passed

SUCCESS  JS and TS Component name and count check passed

SUCCESS  Directive scope check passed


SUCCESS  Sorted dependencies check passed
SUCCESS  Controller dependency line break check passed

09:14:57 FINISHED custom: 2.3 secs

There are no HTML or CSS files to lint.
'TaskThread' object has no attribute 'start_time'
----------------------------------------

There are no HTML or CSS files to lint.
----------------------------------------
Exception in thread third_party:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "scripts/concurrent_task_utils.py", line 72, in run
    (self.name, time.time() - self.start_time), show_time=True)
AttributeError: 'TaskThread' object has no attribute 'start_time'

09:14:57 FINISHED third_party: 0.0 secs

There are no HTML files to lint.
'TaskThread' object has no attribute 'start_time'
----------------------------------------
09:14:57 ERROR third_party: 0.0 secs
```

\cc @Hudda was it introduced due to #8656?
Lint error while pre commit linter runs
I am seeing a new error while running the `pre_commit_linter` script. It also does not cause the lint process to fail.

The error specifically is:
1. 
```
There are no HTML files to lint.
09:14:55 FINISHED custom: 0.0 secs
'TaskThread' object has no attribute 'start_time'
----------------------------------------
09:14:55 ERROR custom: 0.0 secs
```

2. 

```
Exception in thread custom:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "scripts/concurrent_task_utils.py", line 72, in run
    (self.name, time.time() - self.start_time), show_time=True)
AttributeError: 'TaskThread' object has no attribute 'start_time'
```

**Complete log:**
```
Starting Linter....
SUCCESS  Mandatory pattern check passed
----------------------------------------


There are no files to be checked.
09:14:55 FINISHED custom: 0.0 secs
----------------------------------------
SUCCESS  Mandatory pattern check passed


There are no files to be checked.

There are no HTML files to lint.
09:14:55 FINISHED custom: 0.0 secs
'TaskThread' object has no attribute 'start_time'
----------------------------------------
09:14:55 ERROR custom: 0.0 secs
Number of unstarted tasks: 5
----------------------------------------
SUCCESS  Mandatory pattern check passed


----------------------------------------
There are no files to be checked.
09:14:55 FINISHED custom: 0.0 secs

There are no Python files to lint.
'TaskThread' object has no attribute 'start_time'
----------------------------------------
----------------------------------------
SUCCESS  Mandatory pattern check passed


There are no files to be checked.----------------------------------------

09:14:55 FINISHED custom: 0.0 secs
SUCCESS  Mandatory pattern check passed


There are no files to be checked.
----------------------------------------
Tasks still running:
  custom (started 14:44:55)
  custom (started 14:44:55)
  custom (started 14:44:55)
----------------------------------------
09:14:55 FINISHED custom: 0.0 secs
Validating and parsing JS and TS files ...
Exception in thread custom:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "scripts/concurrent_task_utils.py", line 72, in run
    (self.name, time.time() - self.start_time), show_time=True)
AttributeError: 'TaskThread' object has no attribute 'start_time'

SUCCESS  Extra JS files check passed

SUCCESS  JS and TS Component name and count check passed

SUCCESS  Directive scope check passed


SUCCESS  Sorted dependencies check passed
SUCCESS  Controller dependency line break check passed

09:14:57 FINISHED custom: 2.3 secs

There are no HTML or CSS files to lint.
'TaskThread' object has no attribute 'start_time'
----------------------------------------

There are no HTML or CSS files to lint.
----------------------------------------
Exception in thread third_party:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "scripts/concurrent_task_utils.py", line 72, in run
    (self.name, time.time() - self.start_time), show_time=True)
AttributeError: 'TaskThread' object has no attribute 'start_time'

09:14:57 FINISHED third_party: 0.0 secs

There are no HTML files to lint.
'TaskThread' object has no attribute 'start_time'
----------------------------------------
09:14:57 ERROR third_party: 0.0 secs
```

\cc @Hudda was it introduced due to #8656?


Discussion:
@ankita240796 I think this is a `python 2` specific error with `time` module as mentioned [here](https://bugs.python.org/msg221094) and can be solved by swapping `line 114` with `line 115` in [concurrent_task_utils.py](https://github.com/oppia/oppia/blob/develop/scripts/concurrent_task_utils.py). I will open a PR to fix this issue shortly.
@ankita240796 I think this is a `python 2` specific error with `time` module as mentioned [here](https://bugs.python.org/msg221094) and can be solved by swapping `line 114` with `line 115` in [concurrent_task_utils.py](https://github.com/oppia/oppia/blob/develop/scripts/concurrent_task_utils.py). I will open a PR to fix this issue shortly.

Resolving patch:
diff --git a/scripts/concurrent_task_utils.py b/scripts/concurrent_task_utils.py
--- a/scripts/concurrent_task_utils.py
+++ b/scripts/concurrent_task_utils.py
@@ -111,8 +111,8 @@ def execute_tasks(tasks, semaphore):
     while remaining_tasks:
         task = remaining_tasks.pop()
         semaphore.acquire()
-        task.start()
         task.start_time = time.time()
+        task.start()
         currently_running_tasks.append(task)
 
         if len(remaining_tasks) % 5 == 0:


Test patch: