Hannah-Jiang commented on a change in pull request #11428:
URL: https://github.com/apache/beam/pull/11428#discussion_r411834587



##########
File path: sdks/java/container/license_scripts/pull_licenses_java.py
##########
@@ -108,89 +244,27 @@ def write_to_csv(csv_dict):
 
     maven_url_temp = 'https://repo1.maven.org/maven2/{module}/{version}'
 
-    for dep in dependencies['dependencies']:
-        '''
-        An example of a Json blob.
-        {
-            "moduleName": "antlr:antlr",
-            "moduleUrl": "http://www.antlr.org/";,
-            "moduleVersion": "2.7.7",
-            "moduleLicense": "BSD License",
-            "moduleLicenseUrl": "http://www.antlr.org/license.html";
-        }
-        '''
-        name = dep['moduleName'].split(':')[1].lower()
-        version = dep['moduleVersion']
-        name_version = name + '-' + version
-        dir_name = '{license_dir}/{name_version}.jar'.format(
-            license_dir=LICENSE_DIR, name_version=name_version)
-        # if auto pulled, directory is existing at {license_dir}
-        if not os.path.isdir(dir_name):
-            # skip self dependencies
-            if dep['moduleName'].startswith('beam'):
-                print('Skippig', name + '-' + version)
-                continue
-            os.mkdir(dir_name)
-            # pull license
-            try:
-                license_url = dep_config[name][version]['license']
-            except:
-                license_url = dep['moduleLicenseUrl']
-            pull_from_url(dir_name + '/LICENSE', license_url, name_version,
-                          no_licenses)
-            # pull notice
-            try:
-                notice_url = dep_config[name][version]['notice']
-                pull_from_url(dir_name + '/NOTICE', notice_url, name_version,
-                              no_licenses)
-            except:
-                notice_url = None
-        else:
-            try:
-                license_url = dep['moduleLicenseUrl']
-            except:
-                license_url = ''
-            print(
-                'License/notice for {name_version} were pulled automatically.'.
-                format(name_version=name_version))
-
-        # get license_type to decide if pull source code.
-        try:
-            license_type = dep['moduleLicense']
-        except:
-            try:
-                license_type = dep_config[name][version]['type']
-            except:
-                no_license_type.add(name_version)
-                license_type = ''
-                continue
+    csv_list = []

Review comment:
       According to this 
(post)[https://stackoverflow.com/questions/6319207/are-lists-thread-safe], 
`append` operation is thread safe. But I added lock to make sure all records 
are added and the operation is not expensive. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to