Exemplo n.º 1
0
 def list(self, request, *args, **kwargs):
     build_util = LibraryVersionBuildUtil()
     latest_build = build_util.get_latest_build()
     if latest_build is None:
         return Response([])
     serializer = BuildSerializer(latest_build,
                                  context={'request': request})
     return Response([serializer.data])
 def create(self, request, *args, **kwargs):
     build_util = LibraryVersionBuildUtil()
     latest_build = build_util.get_latest_build()
     if latest_build is None or latest_build.task_state == Build.TaskState.FINISHED:
         dir_layout_id = self.kwargs['id']
         start_dirlayout_build.delay(dir_layout_id)
         return Response(
             {
                 'status': 'successful',
                 'message': 'Build process has been successfully started'
             }
         )
     else:
         return Response(
             {
                 'status': 'failure',
                 'message': 'Another build is already in progress. Please wait until it completes'
             },
             status=status.HTTP_409_CONFLICT
         )
Exemplo n.º 3
0
def start_dirlayout_build(self, directory_layout_id):
    from content_management.utils import LibraryVersionBuildUtil
    build_util = LibraryVersionBuildUtil()
    build_util.build_library_version(directory_layout_id)
    print('Done starting the build process')