You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@aurora.apache.org by Kevin Sweeney <ke...@apache.org> on 2015/04/23 00:47:58 UTC

Review Request 33455: Use "a" mode instead of "w" when opening stdout and stderr.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33455/
-----------------------------------------------------------

Review request for Aurora and Brian Wickman.


Repository: aurora


Description
-------

Use "a" mode instead of "w" when opening stdout and stderr.

This allows an external log rotation process to truncate stdout and stderr without causing the creation of a sparse file.


Diffs
-----

  src/main/python/apache/thermos/core/process.py 5ce138dab161d880c0bd58b87a6f5a54d4ca2f99 

Diff: https://reviews.apache.org/r/33455/diff/


Testing
-------

With "w" mode testfile is 300 bytes despite being truncated externally.
```
% python 3> testfile
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> f = os.fdopen(3, 'w')
>>> f.write(100 * 'a')
>>> f.flush()

% echo -n '' > testfile

>>> f.write(200 * 'b')
>>> f.flush()
% ls -l testfile
-rw-r--r--  1 ksweeney  staff  300 Apr 22 15:40 testfile
```

With "a" mode testfile is 200 bytes.
```
% python 3> testfile
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> f = os.fdopen(3, 'a')
>>> f.write(100 * 'a')
>>> f.flush()

% echo -n '' > testfile

>>> f.write(200 * 'b')
>>> f.flush()

% ls -l testfile
-rw-r--r--  1 ksweeney  staff  200 Apr 22 15:40 testfile
```


Thanks,

Kevin Sweeney


Re: Review Request 33455: Use "a" mode instead of "w" when opening stdout and stderr.

Posted by Brian Wickman <wi...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33455/#review84339
-----------------------------------------------------------

Ship it!


Ship It!

- Brian Wickman


On May 11, 2015, 6:37 p.m., Kevin Sweeney wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/33455/
> -----------------------------------------------------------
> 
> (Updated May 11, 2015, 6:37 p.m.)
> 
> 
> Review request for Aurora and Brian Wickman.
> 
> 
> Bugs: AURORA-1317
>     https://issues.apache.org/jira/browse/AURORA-1317
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> Use "a" mode instead of "w" when opening stdout and stderr.
> 
> This allows an external log rotation process to truncate stdout and stderr without causing the creation of a sparse file.
> 
> 
> Diffs
> -----
> 
>   src/main/python/apache/thermos/core/process.py 5ce138dab161d880c0bd58b87a6f5a54d4ca2f99 
> 
> Diff: https://reviews.apache.org/r/33455/diff/
> 
> 
> Testing
> -------
> 
> With "w" mode testfile is 300 bytes despite being truncated externally.
> ```
> % python 3> testfile
> Python 2.7.6 (default, Sep  9 2014, 15:04:36)
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> f = os.fdopen(3, 'w')
> >>> f.write(100 * 'a')
> >>> f.flush()
> 
> % echo -n '' > testfile
> 
> >>> f.write(200 * 'b')
> >>> f.flush()
> % ls -l testfile
> -rw-r--r--  1 ksweeney  staff  300 Apr 22 15:40 testfile
> ```
> 
> With "a" mode testfile is 200 bytes.
> ```
> % python 3> testfile
> Python 2.7.6 (default, Sep  9 2014, 15:04:36)
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> f = os.fdopen(3, 'a')
> >>> f.write(100 * 'a')
> >>> f.flush()
> 
> % echo -n '' > testfile
> 
> >>> f.write(200 * 'b')
> >>> f.flush()
> 
> % ls -l testfile
> -rw-r--r--  1 ksweeney  staff  200 Apr 22 15:40 testfile
> ```
> 
> 
> Thanks,
> 
> Kevin Sweeney
> 
>


Re: Review Request 33455: Use "a" mode instead of "w" when opening stdout and stderr.

Posted by Kevin Sweeney <ke...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33455/
-----------------------------------------------------------

(Updated May 11, 2015, 11:37 a.m.)


Review request for Aurora and Brian Wickman.


Bugs: AURORA-1317
    https://issues.apache.org/jira/browse/AURORA-1317


Repository: aurora


Description
-------

Use "a" mode instead of "w" when opening stdout and stderr.

This allows an external log rotation process to truncate stdout and stderr without causing the creation of a sparse file.


Diffs
-----

  src/main/python/apache/thermos/core/process.py 5ce138dab161d880c0bd58b87a6f5a54d4ca2f99 

Diff: https://reviews.apache.org/r/33455/diff/


Testing
-------

With "w" mode testfile is 300 bytes despite being truncated externally.
```
% python 3> testfile
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> f = os.fdopen(3, 'w')
>>> f.write(100 * 'a')
>>> f.flush()

% echo -n '' > testfile

>>> f.write(200 * 'b')
>>> f.flush()
% ls -l testfile
-rw-r--r--  1 ksweeney  staff  300 Apr 22 15:40 testfile
```

With "a" mode testfile is 200 bytes.
```
% python 3> testfile
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> f = os.fdopen(3, 'a')
>>> f.write(100 * 'a')
>>> f.flush()

% echo -n '' > testfile

>>> f.write(200 * 'b')
>>> f.flush()

% ls -l testfile
-rw-r--r--  1 ksweeney  staff  200 Apr 22 15:40 testfile
```


Thanks,

Kevin Sweeney


Re: Review Request 33455: Use "a" mode instead of "w" when opening stdout and stderr.

Posted by Kevin Sweeney <ke...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33455/#review83244
-----------------------------------------------------------


ping, Brian

- Kevin Sweeney


On April 22, 2015, 3:47 p.m., Kevin Sweeney wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/33455/
> -----------------------------------------------------------
> 
> (Updated April 22, 2015, 3:47 p.m.)
> 
> 
> Review request for Aurora and Brian Wickman.
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> Use "a" mode instead of "w" when opening stdout and stderr.
> 
> This allows an external log rotation process to truncate stdout and stderr without causing the creation of a sparse file.
> 
> 
> Diffs
> -----
> 
>   src/main/python/apache/thermos/core/process.py 5ce138dab161d880c0bd58b87a6f5a54d4ca2f99 
> 
> Diff: https://reviews.apache.org/r/33455/diff/
> 
> 
> Testing
> -------
> 
> With "w" mode testfile is 300 bytes despite being truncated externally.
> ```
> % python 3> testfile
> Python 2.7.6 (default, Sep  9 2014, 15:04:36)
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> f = os.fdopen(3, 'w')
> >>> f.write(100 * 'a')
> >>> f.flush()
> 
> % echo -n '' > testfile
> 
> >>> f.write(200 * 'b')
> >>> f.flush()
> % ls -l testfile
> -rw-r--r--  1 ksweeney  staff  300 Apr 22 15:40 testfile
> ```
> 
> With "a" mode testfile is 200 bytes.
> ```
> % python 3> testfile
> Python 2.7.6 (default, Sep  9 2014, 15:04:36)
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> f = os.fdopen(3, 'a')
> >>> f.write(100 * 'a')
> >>> f.flush()
> 
> % echo -n '' > testfile
> 
> >>> f.write(200 * 'b')
> >>> f.flush()
> 
> % ls -l testfile
> -rw-r--r--  1 ksweeney  staff  200 Apr 22 15:40 testfile
> ```
> 
> 
> Thanks,
> 
> Kevin Sweeney
> 
>


Re: Review Request 33455: Use "a" mode instead of "w" when opening stdout and stderr.

Posted by Aurora ReviewBot <wf...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33455/#review81243
-----------------------------------------------------------


Master (352e0ef) is green with this patch.
  ./build-support/jenkins/build.sh

However, it appears that it might lack test coverage.

I will refresh this build result if you post a review containing "@ReviewBot retry"

- Aurora ReviewBot


On April 22, 2015, 10:47 p.m., Kevin Sweeney wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/33455/
> -----------------------------------------------------------
> 
> (Updated April 22, 2015, 10:47 p.m.)
> 
> 
> Review request for Aurora and Brian Wickman.
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> Use "a" mode instead of "w" when opening stdout and stderr.
> 
> This allows an external log rotation process to truncate stdout and stderr without causing the creation of a sparse file.
> 
> 
> Diffs
> -----
> 
>   src/main/python/apache/thermos/core/process.py 5ce138dab161d880c0bd58b87a6f5a54d4ca2f99 
> 
> Diff: https://reviews.apache.org/r/33455/diff/
> 
> 
> Testing
> -------
> 
> With "w" mode testfile is 300 bytes despite being truncated externally.
> ```
> % python 3> testfile
> Python 2.7.6 (default, Sep  9 2014, 15:04:36)
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> f = os.fdopen(3, 'w')
> >>> f.write(100 * 'a')
> >>> f.flush()
> 
> % echo -n '' > testfile
> 
> >>> f.write(200 * 'b')
> >>> f.flush()
> % ls -l testfile
> -rw-r--r--  1 ksweeney  staff  300 Apr 22 15:40 testfile
> ```
> 
> With "a" mode testfile is 200 bytes.
> ```
> % python 3> testfile
> Python 2.7.6 (default, Sep  9 2014, 15:04:36)
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> f = os.fdopen(3, 'a')
> >>> f.write(100 * 'a')
> >>> f.flush()
> 
> % echo -n '' > testfile
> 
> >>> f.write(200 * 'b')
> >>> f.flush()
> 
> % ls -l testfile
> -rw-r--r--  1 ksweeney  staff  200 Apr 22 15:40 testfile
> ```
> 
> 
> Thanks,
> 
> Kevin Sweeney
> 
>