In the context of the rapid deployment of IoT, 5G, and cloud computing, numerous emerging applications demand efficient networked computing capacity for task offloading from mobile and IoT users. This paper focuses on the optimization of network resource allocation and reduction of end-to-end (E2E) latency through the strategic decision of whether and where to offload user requests in a cloud-edge elastic optical network (CE-EON). To address this problem, we first formulate the problem into an integer linear programming (ILP) model as an initial solution. Additionally, we introduce several heuristic approaches that leverage the concept of partial resource offloading, specifically based on proportional segmentation (PRO_PS), partial resource offloading based on average segmentation (PRO_AS), all resource offloading (ARO), and all local processing (ALP). Furthermore, we implement a collaborative cloud-edge (CCE) offloading approach as a baseline for comparison. Our results demonstrate that the PRO_PS approach closely approximates the optimal solutions obtained from the ILP model in static scenarios. Moreover, the PRO_PS approach achieves the lowest E2E latency, blocking probability, and optimized network resource allocation in dynamic scenarios. This highlights the effectiveness of the proposed approach in improving system performance and addressing the challenges of CE-EONs.