Tips & Traps¶
- Optimus requires Python 3.6+.
Hands on the Python module Multiprocessing
Comments¶
multiprocess is a fork of the Python standard libary multiprocessing . multiprocess extends multiprocessing to provide enhanced serialization, using dill. multiprocess leverages multiprocessing to support the spawning of processes using the API of the python standard library's threading module.
multiprocessing.Pool.mapdoes not work with lambda functions due to the fact that lambda functions cannot be pickled. There are multiple approaches to avoid the issue. You can define a function or usefunctools.partial
Hands on the Python module threading
Gradle Kotlin DSL
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
AVOID using the Kotlin DSL for Gradle! The Kotlin DSL for Gradle is not mature and lack of documentation at this time. Stick with Groovy DSL for Gradle.
shadowJar
https://github …
BufferedReader in Java IO
Comemnt¶
- The methods
BufferedRead.readLineandBufferedRead.linesare very helpful for reading text Files.
public String BufferedRead.readLine¶
Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.
public Stream\<String> BufferedRead.lines¶
Returns a Stream, the elements of which are lines read from this BufferedReader. The Stream is lazily populated, i.e., read only occurs during the terminal stream operation. The reader must not be operated on during the execution of the terminal stream operation. Otherwise, the result of the terminal stream operation is undefined.
Builtin Objects Python
Python has built-in functions and object that users can use directly (no need to import).
However,
if you import another module which hide a built-in function or object,
you cannot use it anymore.
For example,
sum is a built-in function in Python which can be used directly.
However,
if you use PySpark import SQL functions (from pyspark.sql.functions import *